Part Number Hot Search : 
1N5820 C1Z160B BI300 2SK18 4LS85 2SC37 2SB1302 MAX1209
Product Description
Full Text Search
 

To Download AM8530HAM85C30 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  a d v a n c e d m i c r o d e v i c e s am8530h/am85c30 serial communications controller 1992 technical manual
ii ? 1992 advanced micro devices, inc. advanced micro devices reserves the right to make changes in its products without notice in order to improve design or performance characteristics. this publication neither states nor implies any warranty of any kind, including but not limited to implied warrants of merchan- tability or fitness for a particular application. amd assumes no responsibility for the use of any circuitry other than the circuitry in an amd product. the information in this publication is believed to be accurate in all respects at the time of publication, but is subject to change without notice. amd assumes no responsibility for any errors or omissions, and disclaims responsibility for any consequences resulting from the use of the information included herein. additionally, amd assumes no responsibility for the functioning of undescribed features or parameters. product names used in this publication are for identification purposes only and may be trademarks of their respective companies. trademarks z80 and zbus are registered trademarks of zilog, inc. z8000, z8030, and z8530 are trademarks of zilog, inc. multibus is a registered trademark of intel corporation pal is a registered trademark of advanced micro devices, inc.
preface thank you for your interest in the scc, one of the most popular serial data ics available today. this manual is intended to provide answers to technical questions about the am8530h and am85c30. if you have already used the am8530h and are familiar with the previous editions of this technical manual, you will find that some chapters are virtually unchanged. the am8030s functionality, however, has been omitted from this revision since a cmos am8030 was not developed. you can, however, consult the previous am8030/8530 tech- nical manual revision for information pertaining to am8030 operation. functional descriptions of enhancements added to the am85c30 have been included in this technical manual revision. these enhancements improve the am85c30s functional- ity and allow it to be used more effectively in high-speed applications. these enhance- ments include: n a 10 x 19-bit sdlc/hdlc frame status fifo array n a 14-bit sdlc/hdlc frame byte counter n automatic sdlc/hdlc opening flag transmission n automatic sdlc/hdlc tx underrun/eom flag resetting n automatic sdlc/hdlc tx crc generator presetting n rts pin synchronization to closing sdlc/hdlc flag n dtr / req deactivation delay significantly reduced n external pclk to rxc or txc synchronization requirement eliminated for pclk divide- by-four operation n complete sdlc/hdlc crc character reception n reduced int response time n write data setup time to rising edge of wr requirement eliminated n write registers wr3, wr4, wr5, and wr10 made readable most users read only chapters that are of interest to them. if you are designing the micro- computer hardware using the scc as a peripheral, you will want to read the applications section in chapter 7. application notes covering the interfacing of the am8530h (pre h- step and cmos versions only) to the 8086/80186, 68000 processors and am7960 data coded transceiver have been included. as was the case with the nmos scc, some points to look out for when using the am85c30 are: n follow the worksheet for initialization (chapter 7). unexplainable operations may occur if this procedure is not followed. n watch out for the write recovery time violation. the specification for this (trc) was changed on both the h-step and cmos version. it is now referenced from falling edge to falling edge of the read/write pulse. trc is specd at 4 pclks for the nmos h-step and 3 pclks (best case)/3.5 pclks for the am85c30. n ensure mode bits are not changed when writing commands. each mode bit affects only one function and a command bit entry requires a rewrite of the entire register; therefore, care must be taken to insure the integrity of the mode bits whenever a new command is issued. n any unused input pins should be tied high.
table of contents chapter 1 general information 1.1 introduction 1C3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2 capabilities 1C3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.3 block diagram 1C5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.4 pin functions 1C6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.5 pin descriptions 1C8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.5.1 system interface pin descriptions 1C8 . . . . . . . . . . . . . . . 1.5.2 serial channel pin descriptions 1C9 . . . . . . . . . . . . . . . . chapter 2 system interface 2.1 introduction 2C3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2 registers 2C3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3 system timings 2C5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.1 read cycle 2C5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.2 write cycle 2C5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.3 interrupt acknowledge cycle 2C5 . . . . . . . . . . . . . . . . . . . 2.4 register access 2C6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.5 am85c30 enhancement register access 2C7 . . . . . . . . . . . . . . 2.6 reset 2C12 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . chapter 3 i/o programming functional description 3.1 introduction 3C3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2 polling 3C3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.3 interrupt sources 3C3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.4 interrupt control 3C4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.4.1 interrupt enable bit 3C4 . . . . . . . . . . . . . . . . . . . . . . . . . . 3.4.2 interrupt pending bit 3C5 . . . . . . . . . . . . . . . . . . . . . . . . . 3.4.3 interrupt under service bit 3C5 . . . . . . . . . . . . . . . . . . . . 3.4.4 disable lower chain bit 3C5 . . . . . . . . . . . . . . . . . . . . . . 3.5 interrupt operations 3C6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.5.1 multiple interrupt priority resolution 3C6 . . . . . . . . . . . . . 3.5.2 interrupt without acknowledge 3C8 . . . . . . . . . . . . . . . . . 3.5.3 interrupt with acknowledge with vector 3C8 . . . . . . . . . . 3.5.4 interrupt with acknowledge without vector 3C10 . . . . . . . 3.5.5 lower priority interrupt masking 3C10 . . . . . . . . . . . . . . . . 3.6 receive interrupts 3C10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.6.1 receive interrupts disabled 3C10 . . . . . . . . . . . . . . . . . . . . 3.6.2 receive interrupt on first character or special condition 3C10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.6.3 receive interrupt on all receive characters or special conditions 3C11 . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.6.4 receive interrupt on special conditions 3C11 . . . . . . . . . . 3.7 transmit interrupts 3C12 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.8 external/status interrupts 3C13 . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.8.1 sync/hunt 3C13 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.8.2 break/abort 3C14 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.8.3 zero count 3C14 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.8.4 tx underrun/eom 3C15 . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.8.5 clear to send 3C15 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.8.6 data carrier detect 3C15 . . . . . . . . . . . . . . . . . . . . . . . . . .
table of contents amd 3.9 block transfers 3C15 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.9.1 wait on transmit 3C16 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.9.2 wait on receive 3C16 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.9.3 dma requests 3C17 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.9.3.1 dma request on transmit (using w / req ) 3C17 . . . . . . . . . . . . . . . . . . . . . . 3.9.3.2 dma request on transmit (using dtr / req ) 3C18 . . . . . . . . . . . . . . . . . . . . 3.9.3.3 dtr / req deactivation timing 3C19 . . . . . . . . . . 3.9.3.4 dma request on receive (using w / req ) 3C20 . chapter 4 data communication modes functional description 4.1 introduction 4C3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2 protocols 4C3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.1 asynchronous 4C3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.2 synchronous transmission 4C4 . . . . . . . . . . . . . . . . . . . . 4.2.2.1 synchronous character-oriented protocol 4C4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.2.2 synchronous bit-oriented 4C4 . . . . . . . . . . . . . . 4.3 mode selection 4C5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.4 receiver overview 4C6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.4.1 rx character length 4C7 . . . . . . . . . . . . . . . . . . . . . . . . . 4.4.2 rx parity 4C8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.4.3 rx modem control 4C9 . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.5 transmitter overview 4C9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.5.1 tx character length 4C9 . . . . . . . . . . . . . . . . . . . . . . . . . 4.5.2 tx parity 4C11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.5.3 break generation 4C11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.5.4 transmit modem control 4C11 . . . . . . . . . . . . . . . . . . . . . . 4.5.5 auto rts reset 4C11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.6 asynchronous mode operation 4C12 . . . . . . . . . . . . . . . . . . . . . . . 4.6.1 receiver operation 4C12 . . . . . . . . . . . . . . . . . . . . . . . . . . 4.6.1.1 receiver initialization 4C12 . . . . . . . . . . . . . . . . . 4.6.1.2 framing error 4C12 . . . . . . . . . . . . . . . . . . . . . . . 4.6.1.3 break detection 4C13 . . . . . . . . . . . . . . . . . . . . . . 4.6.1.4 clock selection 4C13 . . . . . . . . . . . . . . . . . . . . . . 4.6.2 transmitter operation 4C13 . . . . . . . . . . . . . . . . . . . . . . . . 4.6.2.1 transmitter initialization 4C13 . . . . . . . . . . . . . . . 4.6.2.2 stop bit selection 4C13 . . . . . . . . . . . . . . . . . . . . 4.7 sdlc mode operation 4C14 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.7.1 receiver operation 4C14 . . . . . . . . . . . . . . . . . . . . . . . . . . 4.7.1.1 flag detect output 4C14 . . . . . . . . . . . . . . . . . . . 4.7.1.2 receiver initialization 4C14 . . . . . . . . . . . . . . . . . 4.7.1.3 10x19-bit frame status fifo 4C14 . . . . . . . . . . . 4.7.1.3.1 fifo enabling/disabling 4C15 . . . . . . . . 4.7.1.3.2 fifo read operation 4C15 . . . . . . . . . . 4.7.1.3.3 fifo write operation 4C15 . . . . . . . . . . 4.7.1.3.4 14-bit byte counter 4C15 . . . . . . . . . . . 4.7.1.3.5 am85c30 frame status fifo operation clarification 4C18 . . . . . 4.7.1.3.6 am85c30 aborted frame handling when using the 10x19 frame status fifo 4C19 . . . . . . . . . . . . 4.7.1.4 address search mode 4C19 . . . . . . . . . . . . . . . . . 4.7.1.5 abort detection 4C20 . . . . . . . . . . . . . . . . . . . . . . 4.7.1.6 residue bits 4C21 . . . . . . . . . . . . . . . . . . . . . . . . 4.7.2 sdlc mode crc polynomial selection 4C21 . . . . . . . . . . 4.7.2.1 rx crc initialization 4C22 . . . . . . . . . . . . . . . . . . 4.7.2.2 rx crc enabling 4C22 . . . . . . . . . . . . . . . . . . . .
amd table of contents 4.7.2.3 crc error 4C22 . . . . . . . . . . . . . . . . . . . . . . . . . . 4.7.2.4 crc character reception 4C22 . . . . . . . . . . . . . . 4.7.3 end of frame (eof) 4C26 . . . . . . . . . . . . . . . . . . . . . . . . . 4.8 transmitter operation 4C27 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.8.1 transmitter initialization 4C27 . . . . . . . . . . . . . . . . . . . . . . . 4.8.2 mark/flag idle generation 4C27 . . . . . . . . . . . . . . . . . . . . . 4.8.3 auto flag mode 4C27 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.8.4 abort generation 4C28 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.8.5 auto transmit crc generator preset 4C28 . . . . . . . . . . . . 4.8.6 crc transmission 4C28 . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.8.7 auto tx underrun/eom latch reset 4C29 . . . . . . . . . . . . . 4.8.8 transmitter disabling 4C29 . . . . . . . . . . . . . . . . . . . . . . . . . 4.8.9 nrzi mode transmitter disabling 4C29 . . . . . . . . . . . . . . . 4.9 sdlc loop mode 4C30 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.9.1 going on loop 4C30 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.9.1.1 on loop program sequence 4C31 . . . . . . . . . . . . 4.9.1.2 on loop message transmission 4C31 . . . . . . . . . 4.9.1.3 on loop transmit message programming sequence 4C31 . . . . . . . . . . . . . . . 4.9.2 going off loop 4C31 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.9.2.1 off loop programming sequence 4C32 . . . . . . . . 4.9.3 sdlc loop initialization 4C32 . . . . . . . . . . . . . . . . . . . . . . 4.9.4 sdlc loop nrzi encoding enabled 4C32 . . . . . . . . . . . . . 4.10 synchronous mode operation 4C32 . . . . . . . . . . . . . . . . . . . . . . . . 4.10.1 receiver operation 4C32 . . . . . . . . . . . . . . . . . . . . . . . . . . 4.10.1.1 sync detect output 4C33 . . . . . . . . . . . . . . . . . . 4.10.1.1.1 monosync mode 4C33 . . . . . . . . . 4.11.1.2 bisync mode 4C33 . . . . . . . . . . . . . . . . . . . . . . . 4.10.1.2 sync character length 4C34 . . . . . . . . . . . . . . . 4.10.1.3 receiver initialization 4C34 . . . . . . . . . . . . . . . . . 4.10.1.4 sync character removal 4C34 . . . . . . . . . . . . . . . 4.10.1.5 crc polynomial selection 4C36 . . . . . . . . . . . . . 4.10.1.5.1 rx crc initialization 4C36 . . . . . . . . 4.10.1.5.2 rx crc enabling 4C36 . . . . . . . . . . . 4.10.1.5.3 rx crc character exclusion 4C36 . . 4.10.1.5.4 crc error 4C37 . . . . . . . . . . . . . . . . . 4.10.2 transmitter operation 4C37 . . . . . . . . . . . . . . . . . . . . . . . . 4.10.2.1 transmitter initialization 4C38 . . . . . . . . . . . . . . . 4.10.2.2 crc polynomial selection 4C38 . . . . . . . . . . . . . 4.10.2.2.1 tx crc initialization 4C38 . . . . . . . . . 4.10.2.2.2 tx crc enabling 4C38 . . . . . . . . . . . 4.10.2.2.3 crc transmission 4C38 . . . . . . . . . . 4.10.2.2.4 tx crc character exclusion 4C39 . . 4.10.2.3 transparent transmission 4C39 . . . . . . . . . . . . . . 4.10.2.4 transmitter to receiver synchronization 4C39 . . . 4.10.2.4.1 transmitter disabling 4C40 . . . . . . . . 4.10.2.5 external sync mode 4C40 . . . . . . . . . . . . . . . . . 4.10.2.5.1 sdlc external sync mode 4C41 . . . 4.10.2.5.2 synchronous external sync mode 4C41 . . . . . . . . . . . . . . . . chapter 5 support circuitry programming 5.1 introduction 5C3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.2 clock options 5C3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.2.1 crystal oscillator 5C3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.2.2 receive clock source 5C4 . . . . . . . . . . . . . . . . . . . . . . . . 5.2.3 transmit clock source 5C4 . . . . . . . . . . . . . . . . . . . . . . . 5.2.4 clock programming 5C5 . . . . . . . . . . . . . . . . . . . . . . . . . . 5.3 baud rate generator (brg) 5C6 . . . . . . . . . . . . . . . . . . . . . . . . .
table of contents amd 5.3.1 brg clock source 5C8 . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.3.2 brg enabling/disabling 5C8 . . . . . . . . . . . . . . . . . . . . . . 5.3.3 brg initialization 5C9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.4 data encoding/decoding 5C9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.4.1 nrz (non-return to zero) 5C9 . . . . . . . . . . . . . . . . . . . . . 5.4.2 nrzi (non-return to zero inverted) 5C9 . . . . . . . . . . . . . 5.4.3 fm1 (biphase mark) 5C10 . . . . . . . . . . . . . . . . . . . . . . . . . 5.4.4 fm0 (biphase space) 5C10 . . . . . . . . . . . . . . . . . . . . . . . . 5.4.5 manchester decoding 5C10 . . . . . . . . . . . . . . . . . . . . . . . . 5.4.6 data encoding programming 5C10 . . . . . . . . . . . . . . . . . . . 5.5 digital phase-locked loop (dpll) 5C10 . . . . . . . . . . . . . . . . . . . . 5.5.1 dpll clock source 5C11 . . . . . . . . . . . . . . . . . . . . . . . . . . 5.5.2 dpll enabling 5C11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.5.3 dpll modes 5C11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.5.3.1 nrzi mode 5C11 . . . . . . . . . . . . . . . . . . . . . . . . . 5.5.3.2 fm mode 5C12 . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.5.3.3 manchester decoding mode 5C13 . . . . . . . . . . . . 5.5.3.4 fm mode dpll receive status 5C13 . . . . . . . . . 5.5.4 dpll initialization 5C15 . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.5.5 am85c30-16 dpll operation at 32 mhz 5C15 . . . . . . . . . 5.5.5.1 introduction 5C15 . . . . . . . . . . . . . . . . . . . . . . . . . 5.5.5.2 benefit 5C15 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.5.5.3 applications 5C15 . . . . . . . . . . . . . . . . . . . . . . . . . 5.5.5.4 description 5C15 . . . . . . . . . . . . . . . . . . . . . . . . . 5.5.5.5 competition 5C15 . . . . . . . . . . . . . . . . . . . . . . . . . 5.6 diagnostic modes 5C15 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.6.1 local loopback 5C16 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.6.2 auto echo 5C16 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . chapter 6 register description 6.1 introduction 6C3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.2 write registers 6C5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.2.1 write register 0 (command register) 6C5 . . . . . . . . . . . . 6.2.2 write register 1 (transmit/receive interrupt and data transfer mode definition) 6C7 . . . . . . . . . . . . . . 6.2.3 write register 2 (interrupt vector) 6C9 . . . . . . . . . . . . . . . 6.2.4 write register 3 (receive parameters and control) 6C10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.2.5 write register 4 (transmit/receiver miscellaneous parameters and modes) 6C11 . . . . . . . . . . 6.2.6 write register 5 (transmit parameter and controls) 6C13 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.2.7 write register 6 (sync characters or sdlc address field) 6C15 . . . . . . . . . . . . . . . . . . . . . . . . . 6.2.8 write register 7 (sync character or sdlc flag/sdlc option register) 6C17 . . . . . . . . . . . . . . . . . . 6.2.9 write register 8 (transmit buffer) 6C18 . . . . . . . . . . . . . . . 6.2.10 write register 9 (master interrupt control) 6C18 . . . . . . . . 6.2.11 write register 10 (miscellaneous transmitter/ receiver control bits) 6C20 . . . . . . . . . . . . . . . . . . . . . . . . 6.2.12 write register 11 (clock mode control) 6C23 . . . . . . . . . . 6.2.13 write register 12 (lower byte of baud rate generator time constant) 6C26 . . . . . . . . . . . . . . . . 6.2.14 write register 13 (upper byte of baud rate generator time constant) 6C26 . . . . . . . . . . . . . . . . 6.2.15 write register 14 (miscellaneous control bits) 6C27 . . . . . 6.2.16 write register 15 (external/status interrupt control) 6C29 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3 read registers 6C30 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
amd table of contents 6.3.1 read register 0 (transmit/receive buffer status and external status) 6C30 . . . . . . . . . . . . . . . . . . . . 6.3.2 read register 1 6C33 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3.3 read register 2 6C35 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3.4 read register 3 6C35 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3.5 read register 6 6C36 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3.6 read register 7 6C36 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3.7 read register 8 6C37 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3.8 read register 10 6C37 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3.9 read register 12 6C38 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3.10 read register 13 6C38 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3.11 read register 15 6C39 . . . . . . . . . . . . . . . . . . . . . . . . . . . . chapter 7 scc application notes 7.1 am8530h initialization 7C3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.1.1 introduction 7C3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.1.1.1 register overview 7C3 . . . . . . . . . . . . . . . . . . . . 7.1.1.2 initialization procedure 7C4 . . . . . . . . . . . . . . . . 7.1.1.3 initialization table generation 7C6 . . . . . . . . . . . 7.1.1.4 reset conditions 7C6 . . . . . . . . . . . . . . . . . . . . . 7.2 polled asynchronous mode 7C7 . . . . . . . . . . . . . . . . . . . . . . . . . . 7.2.1 introduction 7C7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.2.2 scc interface 7C8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.2.3 scc initialization 7C8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.2.3.1 scc operating mode programming 7C9 . . . . . . 7.2.3.2 scc operating mode enables 7C10 . . . . . . . . . . 7.2.4 transmit and receive routines 7C10 . . . . . . . . . . . . . . . . . 7.3 interrupt without intack asynchronous mode 7C11 . . . . . . . . . . . . 7.3.1 introduction 7C11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.3.2 scc interface 7C11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.3.3 scc initialization 7C11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.3.3.1 scc operating modes programming 7C12 . . . . . 7.3.3.2 scc operating mode enables 7C13 . . . . . . . . . . 7.3.3.3 scc operating mode interrupts 7C13 . . . . . . . . . 7.3.4 interrupt routine 7C14 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.4 interfacing to the 8086/80186 7C15 . . . . . . . . . . . . . . . . . . . . . . . . 7.4.1 8086 (also called iapx86) overview 7C15 . . . . . . . . . . . . 7.4.1.1 the 8086 and am8530h interface 7C15 . . . . . . . 7.4.1.2 initialization routines 7C18 . . . . . . . . . . . . . . . . . 7.5 interfacing to the 68000 7C20 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.5.1 68000 overview 7C20 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.5.2 the 68000 and am8530h without interrupts 7C21 . . . . . . 7.5.3 the 68000 and am8530h with interrupts 7C23 . . . . . . . . . 7.5.4 the 68000 and am8530h with interrupts via a pal device 7C25 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.6 am7960 and am8530h application 7C26 . . . . . . . . . . . . . . . . . . . . 7.6.1 distributed data processing overview 7C26 . . . . . . . . . . . 7.6.2 data communications at the physical layer 7C27 . . . . . . . 7.6.3 hardware considerations 7C28 . . . . . . . . . . . . . . . . . . . . . 7.6.4 software considerations 7C32 . . . . . . . . . . . . . . . . . . . . . .
1C1 chapter 1 general information 1.1 introduction 1C3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2 capabilities 1C3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.3 block diagram 1C5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.4 pin functions 1C6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.5 pin descriptions 1C8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.5.1 system interface pin descriptions 1C8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.5.2 serial channel pin descriptions 1C9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
general information amd 1C2
1C3 general information chapter 1 1.1 introduction the am85c30 and am8530h sccs (serial communications controller) are dual chan- nel, multiprotocol data communications peripherals designed for use with 8- and 16-bit microprocessors. the scc functions as a serial-to-parallel, parallel-to-serial converter/ controller. the scc can be software configured to satisfy a wide variety of serial commu- nications applications, including: bus architectures (full- and half-duplex), token passing ring (sdlc loop mode), and star configurations (similar to slan). the scc contains a variety of internal functions including on-chip baud rate generators, digital phase-lock loops, and crystal oscillators, which dramatically reduce the need for external logic. in addition, sdlc/hdlc enhancements have been added to the am85c30 that allow it to be used more effectively in high speed applications. the scc handles asynchronous formats, synchronous character-oriented protocols such as ibm bisync, and synchronous bit-oriented protocols such hdlc and ibm sdlc. this versatile device supports virtually any serial data transfer application (telecommuni- cations, cassette, diskette, tape drivers, etc.). the device can generate and check crc codes in any synchronous mode. the scc also has facilities for modem controls in both channels. in applications where these con- trols are not needed, the modem controls can be used for general purpose i/o. with access to the write registers and read registers in each channel, the user can con- figure the scc so that it can handle all asynchronous formats regardless of data size, number of stop bits, or parity requirements. the scc also accommodates all synchro- nous formats including character, byte, and bit-oriented protocols. within each operating mode, the scc also allows for protocol variations by handling odd or even parity bits, character insertion or deletion, crc generation and checking, break/ abort generation and detection, and many other protocol-dependent features. unless otherwise stated, the functional description in this technical manual applies to both the nmos am8530h and cmos am85c30. when the enhancements in the am85c30 are disabled, it is completely downward compatible with the am8530h. 1.2 capabilities n two independent full-duplex channels n synchronous data rates: C up to 1/4 of the pclk (i.e., 4 mbit/sec. maximum data rate with 16 mhz pclk am85c30) C up to 1mbit/second with a 16 mhz clock rate (fm encoding using dpll in am85c30) C up to 500 kbit/second with 16 mhz clock rate (nrzi encoding using dpll in am85c30)
general information amd 1C4 n asynchronous capabilities: C 5, 6, 7, or 8 bits per character C 1, 1-1/2, or 2 stop bits C odd or even parity C x1, 16, 32, or 64 clock modes C break generation and detection C parity, overrun and framing error detection n character-oriented synchronous capabilities: C internal or external character synchronization C 1 or 2 sync characters in separate registers C automatic crc generation/detection n sdlc/hldc capabilities: C abort sequence generation and checking C automatic zero bit insertion and deletion C automatic flag insertion between messages C address field recognition C i-field residue handling C crc generation/detection C sdlc loop mode with eop recognition/loop entry and exit n receiver data registers quadruply buffered. transmitter data register doubly buffered n nrz, nrzi, or fm encoding/decoding and manchester decoding n baud-rate generator in each channel n a dpll in each channel for clock recovery n crystal oscillator in each channel n local loopback and auto echo modes in addition, the am85c30 provides enhancements which allow it to be used more effec- tively in high speed sdlc/hdlc applications. these enhancements include: C 10 x 19-bit sdlc/hdlc frame status fifo C 14-bit sdlc/hdlc frame byte counter C automatic sdlc/hdlc opening flag transmission C automatic sdlc/hdlc tx underrun/eom flag reset C automatic sdlc/hdlc crc generator preset C txd forced high in sdlc nrzi mode when in mark idle C rts synchronization to closing sdlc/hdlc flag C dtr/req dma request deactivation delay reduced C external pclk to rtxc or trxc synchronization requirement removed for one fourth pclk operation C reduced interrupt response time C reduced read/write access recovery time (trc) to 3 pclk best case (3 1/2 pclk worst case) C improved wait timing other enhancements which make the am85c30 more user friendly include: C write data valid setup time to negative edge of write strobe requirement eliminated C write registers wr3, wr4, wr5, wr10 and wr7 are readable C complete reception of sdlc/hdlc crc characters C lower priority interrupt masking without intack generation
general information amd 1C5 1.3 block diagram figure 1C1 depicts the block diagram of the am8530h and figure 1C2 the block diagram of the am85c30. data being received enters the receive data pins and follows one of several data paths, depending on the state of the control logic. the contents of the regis- ters and the state of the external control pins establish the internal control logic. transmit- ted data follows a similar pattern of control, register, and external pin definition. baud rate gen a channel a ch a reg int cont logic discrete control and status a discrete control and status b channel b cp bus i/o ch b reg int cont logic baud rate gen b serial data wait / request sync channel clocks modem, dma, or other controls modem, dma, or other controls serial data wait / request sync channel clocks 5 8 internal bus int cont lines cont data 07513c-001a figure 1C1. am8530h block diagram cpu bus i/o internal control logic interrupt control logic channel a registers channel b registers baud rate generator 10 x 19-bit frame status fifo transmitter/ receiver control logic txda rxda rtxca trxca synca rtsa ctsa dcda channel b txdb rxdb rtxcb syncb rtsb ctsb dcdb trxcb channel a data control 5 8 interrupt control lines internal bus +5 v gnd pclk 10216a-001a figure 1C2. am85c30 block diagram
general information amd 1C6 1.4 pin functions the scc pins are divided into seven functional groups: address/data, bus timing and reset, device control, interrupt, serial data (both channels), peripheral control (both channels), and clocks (both channels). figures 1C3 and 1C4 show the pins in each func- tional group for the 40- and 44-pin scc versions. the address/data group consists of the bidirectional lines used to transfer data between the cpu and the scc. the direction of these lines depends on whether the scc is se- lected and whether the operation is a read or a write. the timing and control groups designate the type of transaction to occur and when this transaction will occur. the interrupt group provides inputs and outputs to conform to the z-bus specifications for handling and prioritizing interrupts. the remaining groups are di- vided into channel a and channel b groups for serial data (transmit or receive), peripher- al control (such as dma or modem), and the input and output lines for the receive and transmit clocks. 10216a-004a ieo rxda txda int intack w / reqa synca rtxca trxca rtsa ctsa dcda rxdb txdb rd wr a/ b ce d/ c w / reqb syncb dtr / reqb rtsb ctsb dcdb iei +5 v pclk gnd 8 bus timing and reset control interrupt channel clocks channel controls for modem, dma, or other serial data serial data channel clocks rtxcb trxcb dtr / reqa channel controls for modem, dma, or other am85c30/ am8530h scc data bus d 0 - d 7 figure 1C3. scc pin functions
general information amd 1C7 10216a-003a 4 3 2 1 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 d 1 d 3 d 5 d 7 iei +5 v rxda pclk txda int intack w / reqa synca rtxca trxca dtr / reqa rtsa ctsa dcda d 0 d 2 d 4 d 6 nc rxdb txdb rd wr a/ b ce d/ c w / reqb syncb rtxcb trxcb dtr / reqb rtsb ctsb dcdb ieo nc gnd nc nc am85c30 1 2 3 4 5 6 7 14 12 11 10 9 8 15 17 18 20 19 21 22 23 24 25 26 27 28 13 16 29 30 31 32 33 34 35 36 37 38 39 40 d 1 d 3 d 5 d 7 int ieo iei intack +5 v w / reqa synca rtxca rxda dtr / reqa rtsa ctsa dcda pclk txda trxca d 0 d 2 d 4 d 6 rd wr a/ b ce d/ c gnd w / reqb syncb rtxcb rxdb trxcb txdb dtr / reqb rtsb ctsb dcdb am8530h am85c30 figure 1C4. pin designation for 40- and 44-pin scc
general information amd 1C8 1.5 pin descriptions figure 1C4 designates the pin locations and signal names for the 40- and 44-pin scc versions. 1.5.1 system interface pin descriptions a/ b channel a/channel b select (input, channel a active high) this signal selects the channel in which the read or write operation occurs and must be valid prior to the read or write strobe. ce chip enable (input, active low) this signal selects the scc for operation. it must remain active throughout the bus transaction. d0Cd7 data lines (bidirectional, 3-state) these i/o lines carry data or control information to and from the scc. d/ c data/control (input, data active high) this signal defines the type of information transfer performed by the scc: data or control. the state of this signal must be valid prior to the read or write strobe. rd read (input, active low) this signal indicates a read operation and, when the scc is selected, enables the scc bus drivers. during the interrupt acknowledge cycle, this signal gates the interrupt vector onto the bus provided that the scc is the highest priority device requesting an interrupt. wr write (input, active low) when the scc is selected, this signal indicates a write operation. on the nmos am8530h data must be valid prior to the rising edge of write strobe. the am85c30 does not share this requirement. the coincidence of rd and wr is interpreted as a reset. iei* interrupt enable in (input, active high) iei is used with ieo to form an interrupt daisy chain when there is more than one inter- rupt-driven device. a high on iei indicates that no other higher priority device has an in- terrupt under service (ius) or is requesting an interrupt. ieo interrupt enable out (output, active high) ieo is high only if iei is high and the cpu is not servicing an scc or scc interrupt or the controller is not requesting an interrupt (interrupt acknowledge cycle only). ieo is con- nected to the next lower priority devices iei input and thus inhibits interrupts from lower priority devices. intack * interrupt acknowledge (input, active low) this signal indicates an active interrupt acknowledge cycle. during this cycle, the interrupt daisy chain settles. when rd becomes active, the scc places an interrupt vector on the data bus (if iei is high). intack is latched by the rising edge of pclk. int interrupt request (output, open-drain, active low) this signal is activated when the scc is requesting an interrupt. note: *pull-up resistors are needed on intack and iei inputs if they are not driven by the system and for the int output. if intack or iei are left floating, the am85c30 will malfunction. int is an open drain output and must be pulled up to keep a logical high level.
general information amd 1C9 1.5.2 serial channel pin descriptions ctsa , ctsb clear to send (inputs, active low) if the auto enable bit in wr3 (d5) is set, a low on these inputs enables the respective transmitter; otherwise they may be used as general-purpose inputs. both inputs are schmitt-trigger buffered to accommodate slow rise-time inputs. the scc detects transi- tions on these inputs and, depending on whether or not other external/status interrupts are pending, can interrupt the processor on either logic level transitions. dcda , dcdb data carrier detect (inputs, active low) these pins function as receiver enables if the auto enable bit in wr3 (d5) is set; other- wise they may be used as general-purpose input pins. both pins are schmitt-trigger buff- ered to accommodate slow rise-time signals. the scc detects transitions on these inputs and, depending on whether or not other external/status interrupts are pending, can inter- rupt the processor on either logic level transitions. dtr / reqa , dtr / reqb data terminal ready/request (outputs, active low) these pins function as dma requests for the transmitter if bit d2 of wr14 is set; other- wise they may be used as general-purpose outputs following the state programmed into the dtr bit. pclk clock (input) this is the master clock used to synchronize internal signals. pclk is not required to have any phase relationship with the master system clock. rtsa , rtsb request to send (outputs, active low) when the request to send (rts) bit in wr5 is set, the rts pin goes low. when the rts bit is reset in the asynchronous mode and the auto enable bit in wr3 (d5) is set, the signal goes high after the transmitter is empty. in synchronous mode or asynchro- nous mode with the auto enable bit reset, the rts pins strictly follow the state of the rts bits. both pins can be used as general-purpose outputs. request to send outputs are not affected by the state of the auto enable (d5) bit in wr3 in synchronous mode. rtxca , rtxcb receive/transmit clocks (inputs, active low) the functions of these pins are under program control. in each channel, rtxc may sup- ply the receive clock, the transmit clock, the clock for the baud rate generator, or the clock for the digital phase-locked loop. these pins can also be programmed for use with the respective sync pins as a crystal oscillator. the receive clock may be 1, 16, 32, or 64 times the data rate in asynchronous mode. if a clock is supplied on these pins in nrzi or nrz mode serial data on the rxd pin will be sampled on the rising edge of these pins. in fm mode, rxd is sampled on both clock edges. rxda , rxdb receive data (inputs, active high) serial data is received through these pins. synca , syncb synchronization (inputs/outputs, active low) these pins can act as either inputs, outputs, or as part of the crystal oscillator circuit. in the asynchronous mode (crystal oscillator option not selected), these pins are inputs simi- lar to cts and dcd . in this mode, transitions on these lines affect the state of the sync/ hunt status bit in read register 0, but have no other function. in external synchronization mode, with the crystal oscillator not selected, these lines also act as inputs. in this mode, sync must be driven low two receive clock cycles after the last bit of the sync character is received. character assembly begins on the rising edge of the receive clock immediately following the activation of sync. in the internal synchronization mode (monosync and bisync), with the crystal oscillator not selected, these pins act as outputs and are active only during the part of the receive clock cycle in which sync characters are recognized. the sync condition is not latched, so
general information amd 1C10 these outputs are active each time a sync character is recognized (regardless of charac- ter boundaries). in sdlc mode, these pins act as outputs and are valid on receipt of a flag. trxca, trxcb transmit/receive clocks (inputs or outputs, active low) the functions of these pins are under program control. trxc may supply the receive clock or the transmit clock in the input mode or supply the output of the digital phase- locked loop, the crystal oscillator, the baud rate generator, or the transmit clock in the out- put mode. if a clock is supplied on these pins in nrzi or nrz mode serial data on the txd pin will be clocked out on the negative edge of these pins. in fm mode, txd is clocked on both clock edges. txda, txdb transmit data (outputs, active high) serial data from the scc is sent out these pins. w / reqa , w / reqb wait/request (outputs, open drain and switches from floating to low when programmed for wait function, driven from high to low when pro- grammed for a request function) these dual-purpose outputs can be programmed as either transmit or receive request lines for a dma controller, or as wait lines to synchronize the cpu to the scc data rate. the reset state is wait.
2C1 chapter 2 system interface 2.1 introduction 2C3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2 registers 2C3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3 system timings 2C5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.1 read cycle 2C5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.2 write cycle 2C5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.3 interrupt acknowledge cycle 2C5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.4 register access 2C6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.5 am85c30 enhancement register access 2C7 . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.6 reset 2C12 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
system interface amd 2C2
2C3 system interface chapter 2 2.1 introduction the scc internal structure provides all the interrupt and control logic necessary to inter- face with non-multiplexed buses. interface logic is also provided to monitor modem or peripheral control inputs or outputs. all of the control signals are general-purpose and can be applied to various peripheral devices as well as used for modem control. the center for data activity revolves around the internal read and write registers. the pro- gramming of these registers provides the scc with functional personality; i.e. register values can be assigned before or during program sequencing to determine how the scc will establish a given communication protocol. this chapter covers the details of interfacing the scc to a system. the general timing requirements are described but the respective data sheets must be referred to for specific a.c. numbers. 2.2 registers all modes of communication are established by the bit values of the write registers. as data are received or transmitted, read register values may change. these changed val- ues can promote software action or internal hardware action for further register changes. the register set for each channel includes several write and read registers. ten write reg- isters are used for control, two for sync character generation, and two for the on-chip baud rate generator. two additional write registers are shared by both channels; one is used as the interrupt vector and one as the master interrupt control. both registers are accessed and shared by either channel. six read registers indicate status functions; two are used by the baud rate generator, and one by the receiver buffer. the remaining two read registers are shared by both channels; one for interrupt pending bits and one for the interrupt vector. on the am85c30 three ad- ditional registers are available. refer to chapter 4 and chapter 6 for further details on these registers. table 2C1 summarizes the assigned functions for each read and write register. chapter 6 provides a detailed bit legend and description of each register.
system interface amd 2C4 table 2C1. register set read register functions rr0 transmit/receive buffer status, and external status rr1 special receive condition status, residue codes, error conditions rr2 modified (channel b only) interrupt vector and unmodified interrupt vector (channel a only) rr3 interrupt pending bits (channel a only) *rr6 14-bit frame byte count (lsb) *rr7 14-bit frame byte count (msb), frame status rr8 receive buffer rr10 miscellaneous xmtr, rcvr status parameters rr12 lower byte of baud rate generator time constant rr13 upper byte of baud rate generator time constant rr15 external/status interrupt control information * available only when am85c30 is programmed in enhanced mode. write register functions wr0 command register, (register pointers), crc initialization, resets for various modes wr1 interrupt conditions, wait/dma request control wr2 interrupt vector (access through either channel) wr3 receive/control parameters, number of bits per character, rx crc enable wr4 transmit/receive miscellaneous parameters and codes, clock rate, number of sync characters, stop bits, parity wr5 transmit parameters and control, number of tx bits per character, tx crc enable wr6 sync character (1st byte) or sdlc address wr7 sync character (2nd byte) or sdlc flag **wr7 sdlc options; auto flag, rts, eom reset, extended read, etc. wr8 transmit buffer wr9 master interrupt control and reset (accessed through either channel), reset bits, control interrupt daisy chain wr10 miscellaneous transmitter/receiver control bits, nrzi, nrz, fm encoding, crc reset wr11 clock mode control, source of rx and tx clocks wr12 lower byte of baud rate generator time constant wr13 upper byte of baud rate generator time constant wr14 miscellaneous control bits: baud rate generator, phase-locked loop control, auto echo, local loopback wr15 external/status interrupt control information-control external conditions causing interrupts ** only available in am85c30.
system interface amd 2C5 2.3 system timings two control signals, rd and wr , are used by the scc to time bus transactions. in addi- tion, four other control signals, ce , d/ c , a/ b and intack are used to control the type of bus transaction that will occur. a bus transaction starts when the d/ c and a/ b pins are asserted prior to the negative edge of the rd or wr signal. the coincidence of ce and rd or ce and wr latches the state of d/ c and a/ b and starts the internal operation. the intack signal must have been previously sampled high by a rising edge of pclk for a read or write cycle to occur. in addition to sampling intack , pclk is used by the interrupt section to set the interrupt pending (ip) bits. the scc generates internal control signals in response to a register access. since rd and wr have no phase relationship with pclk, the circuitry generating these internal control signals provide time for metastable conditions to disappear. this results in a re- covery time related to pclk. this recovery time applies only between transactions involv- ing the am8530h/am85c30, and any intervening transactions are ignored. this recovery time is four pclk cycles, measured from the falling edge of rd or wr for a read or write cycle of any scc register on the am8530h-step and 3 or 3.5 pclk cycles for the am85c30. note that rd and the wr inputs are ignored until ce is activated. the falling edge of rd and wr can be substituted for the falling edge of ce or vice versa for calculating proper pulse width for rd or wr low. in other words, if ce goes active after rd or wr have gone active for a read or a write cycle, respectively, ce must stay active as long as the minimum pulse width for rd and wr . 2.3.1 read cycle the read cycle timing for the scc is shown in figure 2C1. the a/ b and d/ c pins are latched by the coincidence of rd and ce active. ce must remain low and intack must remain high throughout the cycle. the scc bus drivers are enabled while ce and rd are both low. a read with d/ c high does not disturb the state of the pointers and a read cycle with d/ c low resets the pointers to zero after the internal operation is complete. 2.3.2 write cycle the write cycle timing for the scc is shown in figure 2C2. the a/ b and d/ c pins are latched by the coincidence of wr and ce active. ce must remain low and intack must remain high throughout the cycle. a write cycle with d/ c high does not disturb the state of the pointers and a write cycle with d/ c low resets the pointers to zero after the internal operation is complete. 2.3.3 interrupt acknowledge cycle the interrupt acknowledge cycle timing for the scc is shown in figure 2C3. the state of intack is latched by the rising edge of pclk. while intack is low, the state of the a/ b , d/ c , and wr pins is ignored by the scc. between the time intack is first sampled low and the time rd falls, the internal and external iei/ieo daisy chains settle; this is a.c. parameter #38 tdlai (rd). if there is an interrupt pending in the scc, and iei is high when rd falls, the interrupt acknowledge cycle is intended for the scc. this being the case, the scc sets the appro- priate interrupt under service (ius) latch, and places an interrupt vector on d0Cd7. if the falling edge of rd sets an ius bit in the scc, the int pin goes inactive in response to the falling edge. note that there should be only one rd per acknowledge cycle. another important fact is that the ip bits in the scc are updated by a clock half the fre- quency of pclk, and this clock is stopped while the pointers point to rr2 and rr3; thus the interrupt requests will be delayed if the pointers are left pointing at these registers.
system interface amd 2C6 2.4 register access the registers in the scc are accessed in a two-step process, using a register pointer to perform the addressing. to access a particular register, the pointer bits must be set by writing to wr0. the pointer bits may be written in either channel because only one set exists in the scc. after the pointer bits are set, the next read or write cycle of the scc having d/ c low will access the desired register. at the conclusion of this read or write cycle, the pointer bits are automatically reset to 0, so that the next control write will be to the pointers in wr0. a read from rr8 (the receive buffer) or a write to wr8 (transmit buffer) may either be done in this fashion or by accessing the scc having the d/ c pin high. a read or write with d/ c high accesses the receive or transmit buffers directly, and independently, of the state of the pointer bits. this allows single-cycle access to the receive or transmit buffers and does not disturb the pointer bits. the fact that the pointer bits are reset to 0, unless explicitly set otherwise, means that wr0 and rr0 may also be accessed in a single cy- cle. that is, it is not necessary to write the pointer bits with 0 before accessing wr0 or rr0. there are three pointer bits in wr0, and these allow access to the registers with addresses 0 through 7. note that a command may be written to wr0 at the same time that the pointer bits are written. to access the registers with addresses 8 through 15, a special command (point high in wr0) must accompany the pointer bits. this precludes concurrently issuing a command (point high in wr0) when pointing to these registers. the scc register map is shown in table 2C2. pnt 2 , pnt 1 and pnt 0 are bits d2, d1 and d0 in wr0, respectively. if for some reason the state of the pointer bits is unknown, they may be reset to 0 by per- forming a read cycle with the d/ c pin held low. once the pointer bits have been set, the desired channel is selected by the state of the a/ b pin during the actual read or write of the desired register. a/ b , d/ c i ntack ce rd address valid data valid d 0 - d 7 10216a-009a figure 2C1. scc read cycle
system interface amd 2C7 a/ b , d/ c intack ce wr address valid data valid d 0 - d 7 10216a-010a figure 2C2. scc write cycle pclk d 0 C d 7 rd intack iei ieo int vector figure 2C3. interrupt acknowledge cycle 2.5 am85c30 enhancement register access sdlc/hdlc enhancements on the am85c30 are enabled or disabled via bits d2 and d0 in wr15. bit d2 determines whether or not the 10x19-bit sdlc/hdlc frame status fifo is enabled while bit d0 determines whether or not other sdlc/hdlc mode enhance- ments are enabled via wr7. table 2C3 shows what functions on the am85c30 are en- abled when these bits are set. when bit d2 of wr15 is set to 1, two additional registers (rr6 and rr7) per channel specific to the 10x19-bit frame status fifo are made available. the am85c30 register map when this function is enabled is shown in table 2C4.
system interface amd 2C8 table 2C2. scc register map a/ b pnt 2 pnt 1 pnt 0 write read 0 0 0 0 wr0b rr0b 0 0 0 1 wr1b rr1b 0 0 1 0 wr2 rr2b 0 0 1 1 wr3b rr3b 0 1 0 0 wr4b (rr0b) 0 1 0 1 wr5b (rr1b) 0 1 1 0 wr6b (rr2b) 0 1 1 1 wr7b (rr3b) 1 0 0 0 wr0a rr0a 1 0 0 1 wr1a rr1a 1 0 1 0 wr2 rr2a 1 0 1 1 wr3a rr3a 1 1 0 0 wr4a (rr0a) 1 1 0 1 wr5a (rr1a) 1 1 1 0 wr6a (rr2a) 1 1 1 1 wr7a (rr3a) table 2C2. scc register map (continued) a/ b pnt 2 pnt 1 pnt 0 write read with the point high command: [d5C3 (wr0) = 001] 0 0 0 0 wr8b rr8b 0 0 0 1 wr9 (rr13b) 0 0 1 0 wr10b rr10b 0 0 1 1 wr11b (rr15b) 0 1 0 0 wr12b rr12b 0 1 0 1 wr13b rr13b 0 1 1 0 wr14b (rr10b) 0 1 1 1 wr15b rr15b 1 0 0 0 wr8a rr8a 1 0 0 1 wr9 (rr13a) 1 0 1 0 wr10a rr10a 1 0 1 1 wr11a (rr15a) 1 1 0 0 wr12a rr12a 1 1 0 1 wr13a rr13a 1 1 1 0 wr14a (rr10a) 1 1 1 1 wr15a rr15a
system interface amd 2C9 table 2C3. enhancement options wr15 bit d2 wr15 d0 wr7 bit d6 10x19-bit sdlc/hdlc extended fifo enabled enhance enabled read enable functions enabled 1 0 x 10x19-bit fifo enhancement enabled only 0 1 0 sdlc/hdlc enhancements enabled only 0 1 1 sdlc/hdlc enhancements enabled with extended read enabled 1 1 0 10x19-bit fifo and sdlc/ hdlc enhancements enabled 1 1 1 10x19-bit fifo and sdlc/ hdlc enhancements with extended read enabled bit d0 of wr15 determines whether or not other enhancements pertinent only to sdlc/ hdlc mode operation are available for programming via wr7 as shown below. write register 7 prime (wr7 ) can be written to when bit d0 of wr15 is set to 1. when this bit is set, writing to wr7 (flag register) actually writes to wr7 . if bit d6 of this register is set to 1, previously unreadable registers wr3, wr4, wr5, wr10 are readable by the processor. in addition, wr7 is also readable by having this bit set. wr3 is read when a bogus rr9 register is accessed during a read cycle, wr10 is read by accessing rr11, and wr7 is accessed by executing a read to rr14. the am85c30 register map with bit d0 of wr15 and bit d6 of wr7 set is shown in table 2C5.
system interface amd 2C10 table 2C4. 10 x 19-bit fifo enabled a/ b pnt 2 pnt 1 pnt 0 write read 0 0 0 0 wr0b rr0b 0 0 0 1 wr1b rr1b 0 0 1 0 wr2 rr2b 0 0 1 1 wr3b rr3b 0 1 0 0 wr4b (rr0b) 0 1 0 1 wr5b (rr1b) 0 1 1 0 wr6b rr6b 0 1 1 1 wr7b rr7b 1 0 0 0 wr0a rr0a 1 0 0 1 wr1a rr1a 1 0 1 0 wr2 rr2a 1 0 1 1 wr3a rr3a 1 1 0 0 wr4a (rr0a) 1 1 0 1 wr5a (rr1a) 1 1 1 0 wr6a rr6a 1 1 1 1 wr7a rr7a with the point high command: 0 0 0 0 wr8b rr8b 0 0 0 1 wr9 (rr13b) 0 0 1 0 wr10b rr10b 0 0 1 1 wr11b (rr15b) 0 1 0 0 wr12b rr12b 0 1 0 1 wr13b rr13b 0 1 1 0 wr14b (rr10b) 0 1 1 1 wr15b rr15b 1 0 0 0 wr8a rr8a 1 0 0 1 wr9 (rr13a) 1 0 1 0 wr10a rr10a 1 0 1 1 wr11a (rr15a) 1 1 0 0 wr12a rr12a 1 1 0 1 wr13a rr13a 1 1 1 0 wr14a (rr10a) 1 1 1 1 wr15a rr15a
system interface amd 2C11 table 2C5. sdlc/hdlc enhancements enabled a/ b pnt 2 pnt 1 pnt 0 write read 0 0 0 0 wr0b rr0b 0 0 0 1 wr1b rr1b 0 0 1 0 wr2 rr2b 0 0 1 1 wr3b rr3b 0 1 0 0 wr4b rr4b(wr4b) 0 1 0 1 wr5b rr5b(wr5b) 0 1 1 0 wr6b (rr6b) 0 1 1 1 wr7b (rr7b) 1 0 0 0 wr0a rr0a 1 0 0 1 wr1a rr1a 1 0 1 0 wr2 rr2a 1 0 1 1 wr3a rr3a 1 1 0 0 wr4a rr4a(wr4a) 1 1 0 1 wr5b rr5a(wr5a) 1 1 1 0 wr6a (rr2a) 1 1 1 1 wr7a (rr3a) with the point high command: 0 0 0 0 wr8b rr8b 0 0 0 1 wr9 rr9(wr3b) 0 0 1 0 wr10b rr10b 0 0 1 1 wr11b rr11b(wr10b) 0 1 0 0 wr12b rr12b 0 1 0 1 wr13b rr13b 0 1 1 0 wr14b rr14b(wr7b) 0 1 1 1 wr15b rr15b 1 0 0 0 wr8a rr8a 1 0 0 1 wr9 rr9a(wr3a) 1 0 1 0 wr10a rr10a 1 0 1 1 wr11a rr11a(wr10a) 1 1 0 0 wr12a rr12a 1 1 0 1 wr13a rr13a 1 1 1 0 wr14a rr14a(wr7a) 1 1 1 1 wr15a rr15a 0 ext. read enable rx comp. crc dtr / req fast mode force txd high auto rts turnoff auto eom reset auto tx flag d0 d1 d2 d3 d4 d5 d6 d7 wr7 sdlc/hdlc enhancement
system interface amd 2C12 if both bits d0 and d2 of wr15 are set to 1 then the am85c30 register map is as shown in table 2C6. table 2C6. register setall enhancements enabled a/ b pnt 2 pnt 1 pnt 0 write read 0 0 0 0 wr0b rr0b 0 0 0 1 wr1b rr1b 0 0 1 0 wr2 rr2b 0 0 1 1 wr3b rr3b 0 1 0 0 wr4b rr4b(wr4b) 0 1 0 1 wr5b rr5b(wr5b) 0 1 1 0 wr6b rr6b 0 1 1 1 wr7b rr7b 1 0 0 0 wr0a rr0a 1 0 0 1 wr1a rr1a 1 0 1 0 wr2 rr2a 1 0 1 1 wr3a rr3a 1 1 0 0 wr4a rr4a(wr4a) 1 1 0 1 wr5b rr5a(wr5a) 1 1 1 0 wr6a rr6a 1 1 1 1 wr7a rr7a with the point high command: 0 0 0 0 wr8b rr8b 0 0 0 1 wr9 rr9b(wr3b) 0 0 1 0 wr10b rr10b 0 0 1 1 wr11b rr11b(wr10b) 0 1 0 0 wr12b rr12b 0 1 0 1 wr13b rr13b 0 1 1 0 wr14b rr14b(wr7b) 0 1 1 1 wr15b rr15b 1 0 0 0 wr8a rr8a 1 0 0 1 wr9 rr9a(wr3a) 1 0 1 0 wr10a rr10a 1 0 1 1 wr11a rr11a(wr10a) 1 1 0 0 wr12a rr12a 1 1 0 1 wr13a rr13a 1 1 1 0 wr14a rr14a(wr7a) 1 1 1 1 wr15a rr15a 2.6 reset the scc may be reset by either hardware or software. a hardware reset occurs when rd and wr are both low, simultaneously regardless of the state of the ce input, which is normally an illegal condition. as long as both rd and wr are low, the scc recognizes the reset condition. once this condition is removed, however, the reset condition is as- serted internally for an additional four to five pclk cycles. during this time, any attempt to access the scc will be ignored. however a hardware reset does not clear the receive fifo, therefore it may be necessary to perform a few dummy reads immediately after a
system interface amd 2C13 hardware reset to ensure that the fifo is completely flushed before the new data can be received reliably. the scc has three software resets encoded into command bits in wr9. there are two channel resets, which affect only one channel in the device and some of the bits in the write registers. the third command forces the same result as a hardware reset. as in the case of a hardware reset, the scc stretches the reset signal an additional four to five pclk cycles beyond the ordinary valid access recovery time. when the scc is first pow- ered up, performing a read with the d/ c pin held low will guarantee that the pointers are reset to 0; then a reset command can be issued by selecting wr9 and writing to it. the bits in wr9 may be written at the same time as the reset command because these bits are affected only by a hardware reset. the reset values of the various registers are shown in figure 2C4. 00 00 00 00 76543210 00 00 00 00 76543210 00 . 0 0. 00 00 . 0 0. 00 .. .. .. .. 0 0 1 1 0. . 0 00 0. 0. . 0 00 0. . 11 00 00 . . .. 0 00 00 00 00 0. . 0 00 00 00 00 10 00 . . 10 00 00 . . 10 00 . . 11 11 10 00 11 11 10 00 01.. .100 01.. .100 00 00 01 10 00 00 01 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 hardware reset channel reset wr0 wr1 wr2 wr3 wr4 wr5 wr6 wr7 wr9 wr10 wr11 wr12 wr13 wr14 wr15 rr0 rr1 rr3 rr10 .. .. .. . .. .. . .. ....... .. .. .. .. .. .. .. . .. .. . .. .. .. .. .. .. .. .. .. .. .. .. .. ..... .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. figure 2C4. scc register reset values
3C1 chapter 3 i/o programming functional description 3.1 introduction 3C3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2 polling 3C3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.3 interrupt sources 3C3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.4 interrupt control 3C4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.4.1 interrupt enable bit 3C4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.4.2 interrupt pending bit 3C5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.4.3 interrupt under service bit 3C5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.4.4 disable lower chain bit 3C5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.5 interrupt operations 3C6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.5.1 multiple interrupt priority resolution 3C6 . . . . . . . . . . . . . . . . . . . . . . . . . . 3.5.2 interrupt without acknowledge 3C8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.5.3 interrupt with acknowledge with vector 3C8 . . . . . . . . . . . . . . . . . . . . . . . 3.5.4 interrupt with acknowledge without vector 3C10 . . . . . . . . . . . . . . . . . . . . 3.5.5 lower priority interrupt masking 3C10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.6 receive interrupts 3C10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.6.1 receive interrupts disabled 3C10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.6.2 receive interrupt on first character or special condition 3C10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.6.3 receive interrupt on all receive characters or special conditions 3C11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.6.4 receive interrupt on special conditions 3C11 . . . . . . . . . . . . . . . . . . . . . . . 3.7 transmit interrupts 3C12 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.8 external/status interrupts 3C13 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.8.1 sync/hunt 3C13 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.8.2 break/abort 3C14 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.8.3 zero count 3C14 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.8.4 tx underrun/eom 3C15 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.8.5 clear to send 3C15 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.8.6 data carrier detect 3C15 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.9 block transfers 3C15 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.9.1 wait on transmit 3C16 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.9.2 wait on receive 3C16 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.9.3 dma requests 3C17 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.9.3.1 dma request on transmit (using w / req ) 3C17 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.9.3.2 dma request on transmit (using dtr / req ) 3C18 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.9.3.3 dtr / req deactivation timing 3C19 . . . . . . . . . . . . . . . . . . . . . . . 3.9.3.4 dma request on receive (using w / req ) 3C20 . . . . . . . . . . . . . .
i/o programming functional description amd 3C2
3C3 i/o programming functional description chapter 3 3.1 introduction the scc can work under one of the following three modes of i/o operations: polling, interrupts, and block transfer. all three modes involve register manipulation during initiali- zation and data transfer. regardless of the communication mode selected, all three i/o operating modes are available for use and must be programmed in the initialization routine. 3.2 polling polling avoids interrupts and is the simplest mode to implement. in this mode, the soft- ware must poll the scc to determine when data are to be written or read from the scc. this mode is enabled when the master interrupt enable (mie) bit in wr9 (d3) and the wait/dma request enable bit in wr1 (d7) are both set to 0. in this mode the software must poll rr0 to determine the status of the receive buffer, transmit buffer and external/status before jumping to the appropriate interrupt routine. 3.3 interrupt sources when the mie bit in wr9 (d3) is set to 1 interrupts will be enabled and, the scc as a microprocessor peripheral, will request an interrupt by asserting the int pin low from its open-drain state only when it needs servicing. each channel in the scc contains three sources of interrupts making a total of six. these three sources of interrupts are: 1) receiver, 2) transmitter, and 3) external/status conditions as shown in figure 3C1. in addition, there are several conditions that may cause these interrupts. each interrupt source is enabled under program control, with channel a having a higher priority than channel b and with receive, transmit, and ex- ternal/status interrupts prioritized respectively within each channel as shown in table 3C1.
i/o programming functional description amd 3C4 int on 1st rx char. or special condition int on all rx char. or special condition rx int on special condition only parity transmit buffer empty zero count dcd sync/hunt cts tx underrun/eom break/abort scc interrupt external/status interrupt sources transmitter interrupt source receiver interrupt sources figure 3C1. scc interrupts table 3C1. interrupt source priority receiver channel a high transmit channel a external/status channel a receiver channel b transmit channel b external/status channel b low 3.4 interrupt control in addition to the mie bit that enables or disables all scc interrupts, three control/status bits are associated with each interrupt source internal to the scc. these are the interrupt enable (ie), the interrupt pending (ip), and the interrupt under service (ius) bits. simi- larly, lower-priority devices on the external daisy chain can be prevented from requesting interrupts via the disable lower chain bit in wr9 (d2). 3.4.1 interrupt enable bit the interrupt enable (ie) bits are written by the processor and serve to control interrupt requests from each interrupt source on the scc. if the ie bit is set to 1 for an interrupt source, then that source may cause an interrupt request providing all of the necessary conditions are met. if the ie bit is reset, no interrupt request will be generated by that source. the ie bits are write-only and are programmed in wr1 as follows.
i/o programming functional description amd 3C5 d7 w/dma req enable d6 w/dma req funct. d5 w/dma req on rx/tx d4 d3 d2 parity int enable d1 tx int enable d0 ext/sta int enable 0 0 1 1 0 1 0 1 ? rx int disable ? rx int on 1st char. or special condition ? int on all rx char. or special condition ? rx int on special only wr1interrupt source ie 3.4.2 interrupt pending bit the interrupt pending (ip) bit for a given source of interrupt may be set by the presence of an interrupt condition in the scc and is reset directly by the processor, or indirectly by some action that the processor may take. if the corresponding ie bit is not set, the ip for that source of interrupt will never be set. the ip bits in the scc are read-only via rr3 as shown above. d7 0 d6 0 d5 ch. a rx ip d4 ch. a tx ip d3 ch. a ext/sta ip d2 ch. b rx ip d1 ch. b tx ip d0 ch. b ext/sta ip rr3interrupt pending 3.4.3 interrupt under service bit the interrupt under service (ius) bits are not observable by the processor. an ius bit is set during an interrupt acknowledge cycle for the highest-priority ip. the ius bit is used to control the operation of internal and external daisy chain interrupts. the internal daisy chain links the six sources of interrupt in a fixed order, chaining the ius bits for each source. while an internal ius bit is set, all lower-priority interrupt requests are masked off; during an interrupt acknowledge cycle the ip bits are also gated into the daisy chain. this insures that the highest-priority ip selected will have its ius bit set. at the end of an interrupt service routine, the processor must issue a reset highest ius command in wr0 to re-enable lower-priority interrupts. this is the only way, short of a software or hardware reset, that an ius bit may be reset. 3.4.4 disable lower chain bit the disable lower chain (dlc) bit in wr9 (d2) is used to disable all sccs in a lower position on the external daisy chain. if this bit is set to 1, the ieo pin is driven low and prevents lower-priority devices from generating an interrupt request. note that the ius bit, when set, will have the same effect but is not controllable through software, and the point where lower-priority interrupts are masked off may not correspond to the chip boundary.
i/o programming functional description amd 3C6 3.5 interrupt operations interrupts from the scc may be acknowledged with a vector, acknowledged without a vector, or not acknowledged at all. wr2 is used to hold the interrupt vector returned dur- ing an interrupt acknowledge cycle. this vector register can be shared among multiple interrupt sources; some bits of the vector can be encoded with information that identifies the interrupt source. three bits in wr9 determine whether or not a vector is placed on the bus and whether or not status is included. the vector includes status (vis) bit (d0) enables status informa- tion to be included in the vector, the status high/status low bit (d4) determines which bits of the vector are encoded as shown in figure 3C2, and the no vector (nv) bit (d1) enables or disables placing the vector on the bus in response to an interrupt acknowledge cycle. v3 v2 v1 status high/status low = 0 v4 v5 v6 status high/status low = 1 0 0 0 ch b transmit buffer empty 0 0 1 ch b external/status change 0 1 0 ch b receive character available 0 1 1 ch b special receive condition 1 0 0 ch a transmit buffer empty 1 0 1 ch a external/status change 1 1 0 ch a receive character available 1 1 1 ch a special receive condition figure 3C2. interrupt vector modification in addition, the scc can share a common interrupt request line to the processor. an ex- ternal interrupt priority daisy chain, constructed using iei and ieo on each scc, is used to resolve contention when multiple scc devices share an interrupt request line. this ca- pability eliminates the need for separate interrupt controllers. an interrupt acknowledge cycle that includes the generation of an explicit interrupt acknowledge signal ( intack ) is used to select the highest priority scc asserting int . figure 3C3 shows a typical arrange- ment for four sccs, labeled a through d, on the daisy chain, where a has the highest priority and d has the lowest priority. 3.5.1 multiple interrupt priority resolution the scc has an internal priority resolution method to allow the highest priority interrupt to be serviced first. it uses a daisy chain technique of priority interrupt control whereby other scc devices are connected together via an external interrupt daisy chain formed with their interrupt enable input (iei) and interrupt enable output (ieo) pins. the six interrupt sources within each scc are similarly chained together as shown in figure 3C4 with channel a interrupts being higher-priority than any channel b interrupts, and with the re- ceiver, transmitter, and external/status interrupts prioritized in that order within each channel. the overall effect is a daisy chain connecting all internal and external interrupt sources that allows higher priority interrupt sources to pre-empt lower priority sources and, in the case of simultaneous interrupt requests, determines which request will be ac- knowledged.
i/o programming functional description amd 3C7 iei ieo int intack iei ieo int intack iei ieo int intack iei ieo int intack 5 v scc a scc b scc c scc d figure 3C3. external daisy chain interrupt vector receiver channel a interrupt iei intack int ieo transmit channel a interrupt iei intack int ieo external/status channel b interrupt iei intack int ieo intack ip ie ius ip ie ius ip ie ius nv dlc mie vis figure 3C4. internal daisy chain each scc on the daisy chain uses pclk to latch the state of the interrupt acknowledge signal, intack . if a low intack is latched, then the present cycle is an interrupt ac- knowledge cycle and the daisy chain determines which interrupt source is being acknowl- edged in the following way. any interrupt source that has an interrupt pending and is not masked from the chain will hold its ieo line low. similarly, sources that are currently un- der service will also hold their ieo lines low. all other interrupt sources make ieo follow iei. the result is that only the highest priority, unmasked source with an interrupt pending will have a high iei input. this scc will be allowed to transfer its vector to the system bus when the rd strobe is issued during the interrupt acknowledge cycle. to ensure that the daisy chain has settled by the time rd gates the vector onto the bus, the scc requires a delay between falling edge of intack and the falling edge of rd (ac timing parameter #38, tdlai(rd)). the internal daisy chain may be controlled by the mie bit in wr9. this bit, when reset, has the same effect as pulling the iei low, thus disabling all interrupt requests.
i/o programming functional description amd 3C8 the interrupt protocol is diagrammed in figure 3C5. in the quiescent state (i.e. no inter- rupts pending or under service) each scc on the daisy chain passes its iei input through to its ieo output. an interrupt source that requires servicing requests an interrupt by pull- ing the int pin low if the following conditions exist: 1) interrupt source is enabled (i.e., ie and mie bits are set to 1), 2) interrupt source is not already under service (i.e., internal ius bit set to 0), 3) no higher priority interrupt is under service (i.e., internal ius bit set to 1), and 4) an interrupt acknowledge cycle is not currently being executed (i.e., intack is high). when the processor responds with an interrupt acknowledge cycle all sccs that have enabled interrupt sources with an interrupt pending or already under service, hold their ieo outputs lines low. when rd goes low, only the highest priority scc with an inter- rupt pending will have a high iei input; this is the interrupt being acknowledged, and that sources internal ius bit will be set to 1. when servicing of the scc has completed, the reset highest ius command in wr0 must be issued to unlock the daisy chain, reset the ius bit, and enable lower-priority in- terrupt requests. 3.5.2 interrupt without acknowledge in this mode, intack does not have to be generated, and the intack input pin must be tied high. this allows a simpler hardware design that does not have to meet the interrupt acknowledge timing (ac timing parameter #38,tdlai(rd)). soon after the sccs int pin goes active, an external interrupt controller will jump to the interrupt routine. in the inter- rupt routine, the code must read rr2 from channel b to read the vector including status. when the vector is read from channel b, it always includes the status regardless of the vis bit in wr9 (d0). the status given will decode the highest priority interrupt pending at the time rr2 is read. note that the vector is not latched in rr2 so that the next read of rr2 could produce a different vector if another interrupt occurs; however, accessing rr2 disables it from change during the read operation to prevent an error if a higher interrupt occurs exactly during the read operation. once rr2 is read, the interrupt routine must decode the interrupt pending, and clear the condition. for example, writing a character to the transmit buffer will clear the transmit buffer empty ip. removing the interrupt condition clears the ip bit and deactivates int , but only if there are no other ip bits set. when the interrupt ip is cleared, rr2 can be read again. this allows the interrupt routine to clear all ips with one interrupt re- quest to the processor. 3.5.3 interrupt with acknowledge with vector in this mode of operation, the processor must respond to the activation of int by activat- ing intack . after enough time has elapsed to allow the daisy chain to settle (ac timing parameter #38,tdlai(rd)), the scc sets the ius bit for the highest priority ip. if the no vector bit in wr9 (d1) is reset to 0, the scc will then place the interrupt vector on the data bus during the read strobe. to speed the interrupt response time, the scc can also modify 3 bits in the vector to indi- cate status. if it is programmed to include status information in the vector, this status may be encoded and placed in either bits 1C3 or in bits 4C6 as programmed by the status high/status low bit in wr9. to include status, the vis bit in wr9 (d0) must be set to 1. the service routine must then clear the interrupting condition. for example, writing a character to the transmit buffer will clear the transmit buffer empty ip. after the inter- rupting condition is cleared, the routine can read rr3 to determine if any other ip bits are set and clear them. at the end of the interrupt routine, a reset ius command must then be issued via wr0 to unlock the daisy chain and enable lower-priority interrupt requests. this is the only way, short of a software or hardware reset, that an ius bit may be reset.
i/o programming functional description amd 3C9 start condition exits ? interrupt interrupt enable (iex = 1) ? specific interrupt pending set (ip = 1) interrupt enables (mie = 1) ? master peripheral enable pin active (iei = h) is peripheral requests interrupt (int = l) cpu initiates status decode (intack = l) iei/ieo daisy chain settles (wait for ds) priority peripheral disabled unit? has higher unit selected for cpu service (ius = 1) routine complete ? service (option) check other internal ip, bits, still pending (ip = 1) ? interrupt cpu services higher priority peripheral service complete ? priority yes no no yes yes no yes no no yes yes ? (iei = l) no no yes yes no reset ius and exit figure 3C5. interrupt protocol
i/o programming functional description amd 3C10 3.5.4 interrupt with acknowledge without vector if the no vector bit in wr9 (d1) is set to 1, the scc will not place the vector on the data bus during the interrupt acknowledge cycle. an external interrupt controller must then vector the code to the interrupt routine. the interrupt routine must then read rr2 from channel b to read the status. this is the same as the case of an interrupt without an ac- knowledge except that intack needs to be generated. the ius is set as before, and the vector read in rr2 will not change until the reset ius command in wr0 is issued. 3.5.5 lower priority interrupt masking the nmos sccs ability to mask lower priority interrupts is done via the ius bit. this bit is internal to the scc and is not observable by the processor. being able to automatically mask lower priority interrupts allows a modular approach to coding interrupt routines. however, using the masking capabilities of the nmos scc requires that the intack cy- cle be generated. in applications where an external interrupt controller is being used to supply the vector, having to generate intack through external hardware, in order to use this capability, is an unnecessary expense. on the cmos scc if bit d5 in wr9 is set to 1, the intack cycle does not need to be generated in order to have the ius bit set and must be tied high. when this bit is set and an interrupt occurs, reading rr2 will cause the ius bit to be set for the highest priority ip. after the interrupting condition is cleared, the routine can then read rr3 to determine if any other ips are set and clear them. at the end of the interrupt routine, a reset ius command must be issued to unlock the internal daisy chain, and reset the ius bit. note that in this mode the no vector and vector includes status bits in wr9 are ignored. 3.6 receive interrupts four receive interrupt modes are available on the scc. these four modes are: 1) re- ceive interrupts disabled, 2) interrupt on first character or special condition, 3) interrupt on all received characters or special condition, and 4) receive interrupt on special condition only. the mode selected is controlled by bits d4 and d3 of wr1. the special condition inter- rupts are: receive fifo overrun, crc/framing error, eof, and parity. the parity condi- tion can either be included as a special condition or not depending on bit d2 in wr1. the special condition status can be read via rr1. 3.6.1 receive interrupts disabled this mode prevents the receiver from requesting an interrupt. it is used in a polled envi- ronment where either rr0 or the modified vector in rr2 (channel b) is read for status. when either rr0 or rr2 indicates that a received character has reached the top of the receive data fifo, the status should be read first and then rr8 because reading rr8 moves the next character in the receive data fifo and error fifo up one location. if status is read after the data are read, the error data belonging (if any) to the next charac- ter in the fifo will also be included. if, however, operations are being performed rapidly enough so that the next character has not yet been received, then the status will remain valid. although the receiver interrupts are disabled, a special condition can still provide a unique vector status in rr2. 3.6.2 receive interrupt on first character or special condition this mode is designed for use with an external dma controller. after this mode is se- lected, the first character received, or the first character already stored in the receive data fifo, will set the receiver ip. this ip will be reset when this character is removed from the scc, and no further receive interrupts will occur until the processor issues an enable interrupt on next receive character command in wr0 or until a special condi- tion interrupt occurs.
i/o programming functional description amd 3C11 the scc recognizes several special conditions during data reception. a receiver over- run, where a character in the data fifo is overwritten, is a special condition, as is a framing error in asynchronous mode, or the eof condition in sdlc mode. in addition, if bit d2 of wr1 is set to 1, any character with a parity error will generate a special condi- tion interrupt. the correct sequence of events when using this mode is to first select the mode and wait for the receive character available interrupt. when the interrupt occurs, the processor should read the character and then enable the dma to transfer the remaining characters. a special condition interrupt may occur at any time after the first character is received but is guaranteed to occur after the character having the special condition has been read from the receive data fifo. the status is not lost in this case, however, because the data fifo will be locked by the special condition preventing further data from becoming available in the receive data fifo until the error reset command is issued. in the serv- ice routine the processor should read rr1 to obtain the status and may read the data again if necessary before unlocking the fifo by issuing an error reset command in wr0. if the special condition detected was eof, the processor should then issue the enable interrupt on next receive character command to prepare for the next frame. the first character and special condition interrupt are distinguished by the status included in the interrupt vector. in all other respects they are identical, including sharing the ip and ius bits. in the am85c30, if the 10x19 frame status fifo is enabled, the 3 byte receive (rx) fifo never locks. however, the dma is disabled (only on overrun special condition), i.e. overruns do not lock the rx fifo, but do disable dma. interrupts are generated and re- main active until the reset error command is issued. 3.6.3 receive interrupt on all receive characters or special conditions this mode is designed for an interrupt-driven system. in this mode, the scc will set the receiver ip on every received character, whether or not it has a special condition. this includes characters already in the fifo when this mode is selected. in this mode of op- eration, the receiver ip is reset when the character is removed from the fifo, so if the processor requires status for any character, this status must be read before the data is removed from the fifo. the special conditions are identical to those previously mentioned, and as before, the only difference between a receive character available interrupt and a special condition interrupt is the status encoded in the vector. in this mode, a special condition does not lock the receive data fifo so that the service routine must read the status in rr1 be- fore reading the data. at moderate to high data rates, where the interrupt overhead is sig- nificant, time can usually be saved by checking for another received character before exit- ing the service routine. this technique eliminates the interrupt acknowledge and the proc- essor-state-saving time, but care must be exercised because this receive character must be checked for special receive conditions before it is removed from the scc. 3.6.4 receive interrupt on special conditions this mode is designed for use with dma transfers of the receive characters. in this mode, only receive characters with special conditions will cause the receive ip to be set. all other characters are assumed to be transferred via dma. no special initialization se- quence is needed in this mode. usually the dma is initialized and enabled, and then this mode is selected in the scc. a special condition interrupt may occur at any time after this mode is selected, but the logic guarantees that the interrupt will not occur until after the character with the special condition has been read from the scc. the special condi- tion locks the fifo so that the status will be valid when read in the interrupt service rou- tine, and it guarantees that the dma will not transfer any characters until the special con- dition has been serviced. in the service routine, the processor should read rr1 to obtain
i/o programming functional description amd 3C12 the status and unlock the fifo by issuing an error reset command. dma transfer of the receive characters will then resume. if receive interrupts on special condition only is enabled and a special condition occurs then, if a modified vector is read from rr2 or as the output of an intack cycle, that vec- tor may indicate receive character available instead of receive special condition. the reason is that if a character is received and simultaneously the special condition occurs, the priority circuitry gives receive character available the highest priority and thus over- rides the special condition. note that a receive character available itself does not gen- erate an interrupts if receive interrupts on special condition only is enabled. it is the special condition that generates the interrupt. in am85c30, if the 10 x 19 frame status fifo is enabled, the 3 byte receive (rx) fifo never locks. however, the dma is disabled (only on overrun special condition), i.e. over- runs do not lock the rx fifo, but do disable dma. interrupts are generated and remain active until reset error command is issued. 3.7 transmit interrupts the transmit interrupt request has only one source; it can be set only when wr8 (trans- mit buffer) goes from full to empty. note that this means that the transmit interrupt will not be set until after the first character is written to the scc. transmit interrupt occurs, if enabled, when the transmit buffer goes from a full to an empty state, which happens when the buffered character is loaded into the transmit shift register from the transmit buffer. in sdlc or other synchronous modes with the crc gen- erator enabled, the two crc bytes that are attached to the data forces the transmit shift register to be full. when the second byte of the crc is loaded into the transmit shift regis- ter, a transmit interrupt is generated if it is enabled. transmit interrupts are controlled by the transmit interrupt enable bit in wr1 (d1). if the interrupt capabilities of the scc are not required, polling may be used. this is selected by disabling the transmit interrupts and polling the transmit buffer empty bit in rr0. when the transmit buffer empty bit is set, a character may be written to the scc without fear of writing over previous data. another way of polling the scc is to enable the transmit inter- rupt and then reset the mie bit in wr9. the processor may then poll the ip bits in rr3a to determine when the transmit buffer is empty. transmit interrupts should also be dis- abled in the case of dma transfer of the transmitted data. while the transmit interrupts are enabled, the scc will set the transmit ip whenever the transmit buffer becomes empty. this means that the transmit buffer must have been full before the transmit ip can be set. thus, when the transmit interrupts are first enabled, the transmit ip will not be set until after the first character is written to the scc. in sdlc and synchronous modes, one other condition can cause the transmit ip to be set. this occurs at the end of the crc transmission. when the last bit of crc has cleared the transmit shift register and the flag or sync character is loaded into the transmit shift register, the scc will set the transmit ip. data for the new frame or mes- sage to be transmitted may be written at this time. the transmit buffer empty bit will be set after each transmit ip. at the end of a frame or message block of data where crc is to be sent next, no data will be written to the scc (a reset tx ip command can be issued to clear the transmit ip). the transmitter will then underflow, the crc will be sent and the transmit buffer empty bit will be reset (indicating that data should not be written to the scc at this time). the transmit underrun/eom bit will be set when the crc is loaded to indicate that the transmitter has underflowed. after the last bit of crc has cleared the transmit shift register and the flag or sync character is loaded into the transmit shift register the scc will set the transmit ip. the transmit buffer empty bit will be set at this time, indicating that data for the new frame should be written. the transmit ip is reset either by writing data to wr8 or by issuing the reset transmit ip command in wr0. ordinarily, the response to a transmit interrupt is to write more data to the scc; however, at end of a frame or meassage block of data where crc is to be sent next, the reset transmit ip command should be issued in lieu of data.
i/o programming functional description amd 3C13 3.8 external/status interrupts the external/status interrupts are globally enabled via wr1 and may be individually en- abled via wr15 as shown below. the external/status interrupt sources are: 1) zero count, 2) dcd, 3) sync/hunt, 4) cts, 5) tx underrun/eom, and 6) break/abort. d7 break/ abort ie d6 tx undr/ eom ie d5 cts ie d4 sync/ hunt ie d3 dcd ie d2 d1 zero count ie d0 d7 d6 d5 d4 d3 d2 d1 d0 ext/ status mie wr15 and wr1register layout the individual external/status interrupt enable bits in wr15 control whether or not latches will be present in the path from the source of interrupt to the status bit in rr0. if an individual enable bit in wr15 is set to 0, the latches are not present in the signal path and the value read in rr0 reflects the current status. an interrupt source whose individ- ual enable bit in wr15 is set to 0 is not a source of external/status interrupts even though the external/status master interrupt enable bit is set to 1 in wr1 (d0). when an individual enable bit in wr15 is set to 1, the latch is present in the signal path. the latches for the sources of external/status interrupts are not independent. rather, they all close at the same time as a result of a state change by one of the sources of in- terrupt. thus, a read of rr0 returns the current status for any bits whose individual en- able bit in wr15 is set to 0, and either the current state or the latched state of the re- mainder of the bits. to guarantee the current status, the processor should issue a reset external/status interrupts command in wr0 to open the latches. the external/status ip in rr3 is set by the closing of the latches and remains set for as long as they are closed. if the master external/status interrupt enable bit is not set, the ip will never be set, even though the latches may be present in the signal paths and working as described. because the latches close on the current status but give no indication of change, the processor must maintain a copy of rr0 in memory. when the scc gener- ates an external/status interrupt, the processor should read rr0 and determine which condition changed state and take the appropriate action. the copy of rr0 in memory must then be updated and the reset external/status interrupt command issued. care must be taken in writing the interrupt service routine for the external/status inter- rupts because it is possible for more than one status condition to change state at the same time. all of the latched bits in rr0 should be compared to the copy of rr0 in mem- ory. if none have changed and the zc interrupt is enabled, the zero count condition caused the interrupt. 3.8.1 sync/hunt the sync/hunt status bit reports the hunt state of the receiver in sdlc and synchro- nous modes. this bit is set to 1 when the processor issues the enter hunt command, and is reset to 0 when character synchronization is established by the receiver. if the sync/hunt ie bit in wr15 is set to 1, the external/status latches close, and an exter- nal/status interrupt will be generated on both the low-to-high and high-to-low transitions of the sync/hunt status bit.
i/o programming functional description amd 3C14 in external sync mode, the sync/hunt status bit, as in asynchronous mode, reports the state of the sync pin. if there are no other external/status interrupts pending, then any transition on the sync pin will cause the latches to close and generate an external/ status interrupt. however, only an odd number of transitions on sync , while another ex- ternal/status interrupt is pending, will close the latches and generate an external/status interrupt. 3.8.2 break/abort the break/abort status bit is used in asynchronous and sdlc modes but is always set to 0 in synchronous modes. both a low-to-high and high-to-low transition are guar- anteed to cause the external/status latches to close, and if the break/abort ie bit in wr15 is set to 1, generate an external/status interrupt regardless of whether another external/status interrupt is pending at the time the transitions occur. if break/abort is detected while the latches are closed, the status will be saved and generate an interrupt for break/abort detection upon issuing the reset external/status interrupts. a second interrupt is generated for end of break/abort after issuig the next reset external/ status interrupts. in the first case, the break/abort bit will be set to 1, and in the sec- ond case to 0. this will guarantee that the break/abort sequence is detected cor- rectly. a break/abort occurrence will clear an end of break/abort that is waiting to generate an interrupt. therefore, multiple break/abort sequences while the latches are closed will generate only two interrupts, one for break/abort detection, and one for end of break/abort. in asynchronous mode, this bit will be set to 1 when a break sequence (null character plus framing error) is detected (i.e., rxd is low for more than one full character time) in the receive data stream, and remains set for as long as 0s continue to be received. it is reset when a 1 is received. note that a single null character is left in the receive data fifo each time a break condition is terminated. this character should be read and dis- carded. in sdlc mode, this status bit is set to 1 when an abort sequence is detected in the re- ceive data stream and is reset when a 0 is received. note that the receiver detects an abort pattern whether it is in frame or out of frame, so to avoid confusion, the break/ abort ie bit in wr15 should be set to 1 in the sync/hunt interrupt routine when the sync/hunt status bit indicates that the receiver is in frame (i.e., sync/hunt status bit transitions from high-to-low), and should be reset to 0 early in the eof interrupt rou- tine. 3.8.3 zero count the zero count (zc) status bit reflects when the baud rate generator counter reaches a count of 0. the zc status bit will be set to 1 when the zero count is reached and will be reset to 0 when the counter is re-loaded. the external/status latches will close only on the low-to-high transition of this bit and, if the zero count ie bit is set in wr15, generate an external/status interrupt. this status bit is not latched in rr0 even though the exter- nal/status latches close as a result of the transition. if there are no other external/status interrupt conditions pending at the time the zc status bit is set, an external/status interrupt will be generated. however, if there is another ex- ternal/status interrupt pending at the time zc is set, no interrupt will be generated until the current interrupt service is complete. if the zero count condition does not persist be- yond the end of the current interrupt service routine no interrupt will be generated. the interrupt service routine should check the other external/status conditions for changes. if none changed, the zc was the source of interrupt. in polled applications, the ip bits in rr3a should be checked for a status change before proceeding as in the interrupt serv- ice routine. note that while the zero count ie bit in wr15 is reset, the zc status bit will always read 0.
i/o programming functional description amd 3C15 3.8.4 tx underrun/eom the tx underrun/eom status bit is used in sdlc and synchronous modes of operation to control the transmission of crc characters. this bit is set to 1 when the transmit buffer and transmit shift register go empty and is reset to 0 by issuing the reset transmit underrun/eom command in wr0. only the low-to-high transition of this bit will cause the latches to close and, if the tx underrun/eom ie bit in wr15 (d6) is set to 1, cause an external/status interrupt to be generated. this status bit is always set to 1 in asynchronous mode unless a reset transmit under- run/eom command is erroneously issued. in this case, the send abort command can be used to set this bit to 1 and, at the same time, cause an external/status interrupt. note that this bit will be set to 1 when either of the following occurs; 1) a send abort command is issued, 2) the transmitter is disabled, or 3) a channel or hardware reset is executed. 3.8.5 clear to send the cts status bit reports the state of the cts input pin the last time any of the enabled external/status bits changed. any transition on the cts pin, while no other interrupts are pending, latches the state of the cts pin and generates an external/status interrupt if the cts ie bit in wr15 is set to 1. however, only an odd number of transitions on the cts pin while another external/status is pending will cause an external/status interrupt after the reset external/status interrupt command is issued. if the cts ie bit is reset, the cts status merely reports the current inverted unlatched state of the cts pin; that is, if the cts pin is low, the cts status bit will be high. note that after the reset external/status interrupt command is issued, if the latches were closed, they will close again if there was an odd number of transitions on the cts pin; they will remain open if there was an even number of transitions on the input pin. 3.8.6 data carrier detect the dcd status bit reports the state of the dcd input pin the last time any of the enabled external/status bits changed. any transition on the dcd pin, while no other interrupts are pending, latches the state of the dcd pin and generates an external/status interrupt if the dcd ie bit in wr15 is set to 1. however, only an odd number of transitions on the dcd pin while another external/status is pending will cause an external/status interrupt after the reset external/status interrupt command is issued. if the dcd ie bit is reset, the dcd status merely reports the current inverted unlatched state of the dcd pin; that is, if the dcd pin is low, the dcd status bit will be high. note that after the reset external/status interrupt command is issued, if the latches were closed, they will close again if there was an odd number of transitions on the dcd pin; they will remain open if there was an even number of transitions on the input pin. if careful attention is paid to details, the interrupt service routine for external/status inter- rupts is straightforward. to determine which bit or bits changed state, the routine should first read rr0 and compare it to a copy from memory. for each changed bit, the appro- priate action should be taken and the copy in memory updated. the service routine should close with a reset external/status interrupts command to re-open the latches. the copy of rr0 in memory should always have the zero count bit set to 0, since this will be the state of the bit after the reset external/status interrupts command at the end of the service routine. 3.9 block transfers the scc offers several alternatives for the block transfer of data. the various options are selected via wr1 and wr14 as follows.
i/o programming functional description amd 3C16 d7 d6 d5 d4 d3 d2 d1 dtr/ req funct. d0 wait/ dma req funct. wait/ dma req enable wait/ dma req rx/tx d7 d6 d5 d4 d3 d2 d1 d0 wr14 register layout wr1 register layout each channel in the scc has two pins, dtr / req and w / req , which may be used to control the block transfer of data. both pins in each channel may be programmed to act as dma request signals, and one pin ( w / req ) in each channel may be programmed to act as a wait signal for the cpu. in either mode, it is advisable to select and enable the mode in two separate accesses of the appropriate register. the first access should select the mode and the second access should enable the function. this procedure prevents glitches on the output pins. reset forces wait mode, with w / req open-drain. 3.9.1 wait on transmit the wait function on transmit is selected by programming wr1 as shown below. 100????? d7 d6 d5 d4 d3 d2 d1 d0 wr1wait on transmit function selection in this mode, the w / req pin carries the wait signal, and is open-drain when inactive and low when active. when the processor attempts to write to wr8 (transmit buffer) and it is full, the scc will assert w / req until the buffer is empty. this allows the use of a block- move instruction to transfer the transmit data. w / req will go active in response to wr going active but only if wr8 (transmit buffer) is being accessed, either directly or via the pointers. the w / req pin is released in response to the falling edge of pclk. details of the timing are shown in figure 3C6. 3.9.2 wait on receive the wait function on receive is selected by programming wr1 as shown below. 101????? d7 d6 d5 d4 d3 d2 d1 d0 wr1wait on receive function selection
i/o programming functional description amd 3C17 in this mode, the w / req pin carries the wait signal, and is open-drain when inactive and low when active. when the processor attempts to read data from the receive data fifo and it is empty, the scc will assert w / req until a character has reached the top of the fifo. this allows the use of a block-move instruction to transfer the receive data. w / req will go active in response to rd going active, but only if rr8 (receive buffer) is being accessed, either directly or via the pointers. the w / req pin is released in response to the falling edge of pclk. details of the timing are shown in figure 3C7. 3.9.3 dma requests the two dma request pins, w / req and dtr / req , can be programmed to be used as dma requests. the w / req pin can be used as either a transmit or a receive request, but the dtr / req pin can be used only as a transmit request. hence, for full-duplex opera- tion, the w / req pin should be used for receive and the dtr / req pin used for transmit. these modes are described below. 3.9.3.1 dma request on transmit (using w / req ) the dma request on transmit function using the w / req pin is enabled by programming wr1 as shown below. 110????? d7 d6 d5 d4 d3 d2 d1 d0 wr1dma on transmit function selection async modes sync modes trxc pclk wait figure 3C6. wait on transmit timing async modes sync modes rtxc pclk wait 1 2 3 4 5...8 9 10 11 12 13 figure 3C7. wait on receive timing
i/o programming functional description amd 3C18 in this mode the w / req pin carries the dma request signal, which is active low. when this mode is selected, but not yet enabled, the w / req pin is driven high. when the en- able bit is set, w / req will go low if wr8 is empty at the time or will remain high until wr8 becomes empty. note that the w / req pin will follow the state of wr8 even though the transmitter is disabled. thus, if bit d7 of wr1 is set to 1 (i.e., w / req pin is enabled) before the transmitter is enabled, the dma may write data to the scc prematurely. this will not cause a problem in asynchronous mode but may cause problems in sdlc and synchronous modes, because on enabling the transmitter the scc will send data in pref- erence to flags or sync characters. it also may complicate the crc initialization, which cannot be done until after the transmitter is enabled. with only one exception, the w / req pin directly follows the state of wr8 in this mode. w / req goes low when wr8 goes empty and remains low until the wr8 is filled. the scc generates only one falling edge on the w / req pin per character requested. the timing for this is shown in figure 3C8. the one exception occurs at the end of crc transmission when the scc is programmed in either sdlc or synchronous modes. at the end of crc transmission, when the closing flag or sync character is loaded into the transmit shift register, the w / req pin is pulsed high for one pclk cycle. the dma may use this falling edge on w / req to write the first character of the next frame or block to the scc. w / req will go high in response to the falling edge of wr , but only when the appropriate wr8 in the scc is accessed. this is shown in figure 3C9. 3.9.3.2 dma request on transmit (using dtr / req ) a second request on transmit function is available on the dtr / req pin. this mode is selected by programming wr14 as shown below. ?????1?? d7 d6 d5 d4 d3 d2 d1 d0 wr14dma request on transmit using dtr / req when this bit is set to 1, the dtr / req pin will go low if wr8 is empty at the time, or will go high until wr8 becomes empty. while bit d2 of wr14 is set to 0, the dtr / req pin is used as a general-purpose output pin and follows the inverted state of bit d7 in wr5. this pin will be high after a channel or hardware reset and in the dtr mode. in the dma request mode, dtr / req will follow the empty/non-empty state of wr8 even though the transmitter is disabled. thus, if the dma request function is enabled before the transmitter is enabled, the dma may write data to the scc prematurely. this will not cause a problem in asynchronous mode but may cause problems in sdlc and synchro- nous modes because the scc will send data in preference to flags or sync characters. it also may complicate the crc initialization, which cannot be done until after the transmit- ter is enabled and idling. with only one exception, the dtr / req pin directly follows the state of wr8 in sdlc and synchronous modes. dtr / req goes low when wr8 be- comes empty and remains low until wr8 is filled. the scc generates only one falling edge on the dtr / req pin per character requested and the timing for this is shown in figure 3C8. the one exception occurs in sdlc and synchronous modes at the end of crc transmis- sion. at the end of crc transmission, when the closing flag or sync character is loaded into the transmit shift register, dtr / req is pulsed high for one pclk cycle. the dma may use this falling edge on dtr / req to write the first character of the next frame or block to the scc.
i/o programming functional description amd 3C19 3.3.9.3 dtr / req deactivation timing on the nmos scc, the dma request function on dtr / req differs from the one on w / req in that it does not go high immediately in response to the access which writes to wr8. this is because the registers in the scc are not written during the actual access, but are delayed by some number of pclk cycles. the dma request signal on dtr / req follows the state of wr8 exactly while the request signal on w / req goes inactive in an- ticipation of wr8 becoming full. the timing of the request signal on both pins is shown in figure 3C9. this deactivation delay of dtr / req is unacceptable in applications where slower data rates are involved relative to the processor. this delay can result in overwriting the trans- mit buffer because the dma controller may recognize the continued active state of dtr / req as a request for more data. on the cmos scc an option is provided that en- ables the deactivation delay of dtr / req to be identical to that of the w / req pin. if sdlc mode operation is selected and bit d0 of wr15 is set to 1, then bit d4 of wr7 can be used to alter the deactivation delay. while bit d4 of wr7 is set to 1, the deacti- vation of dtr / req will be identical to w / req . async modes sync modes trxc pclk req ( dtr / req ) req ( w / req ) figure 3C8. dma request on transmit activation wr d 0 C d 7 pclk req ( dtr / req ) req ( w / req ) figure 3C9. dma request on transmit deactivation
i/o programming functional description amd 3C20 3.3.9.4 dma request on receive (using w / req ) the dma request on receive function using the w / req pin is selected by programming wr1 as shown below. 111????? d7 d6 d5 d4 d3 d2 d1 d0 wr1dma request on receive using w / req in this mode, the w / req pin carries the dma request signal, which is active low. when this mode is selected, but not yet enabled, the w / req pin is driven high. when the en- able bit is set, w / req will go low if rr8 contains a character at the time, or will remain high until a character enters rr8. note that the w / req pin will follow the state of rr8 even though the receiver is disabled. thus, if the receiver is disabled but the dma re- quest function is enabled, the dma will transfer the previously received data correctly. in this mode the w / req pin directly follows the state of rr8 with only one exception. the w / req pin goes low when a character enters rr8 and remains low until this character is removed from the receive buffer. the scc generates only one falling edge on w / req per character transfer requested and the timing for this is shown in figure 3C10. the one exception occurs in the case of a special receive condition in the receive inter- rupt on first character or special condition mode, or the receive interrupt on special condition only mode. in these two interrupt modes any receive character with a special receive condition is locked at the top of the fifo until an error reset command is issued. this character in the receive fifo would ordinarily cause additional dma requests after the first time it is read. however, the logic in the scc guarantees only one falling edge on w / req by holding the w / req pin high from the time the character with the special re- ceive condition is read, and the fifo locked, until after the error reset command has been issued. once the fifo is unlocked by the error reset command, w / req again follows the state of the receive buffer. w / req will go high in response to the falling edge of rd , but only when the receive buffer in the scc is accessed. this is shown in figure 3C11.
i/o programming functional description amd 3C21 async modes sync modes rtxc pclk wait 1 2 3 4 5...8 9 10 11 12 13 figure 3C10. dtr / req activation wr d 0 C d 7 pclk req receive data figure 3C11. dtr / req deactivation
4C1 chapter 4 data communication modes functional description 4.1 introduction 4C3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2 protocols 4C3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.1 asynchronous 4C3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.2 synchronous transmission 4C4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.2.1 synchronous character-oriented protocol 4C4 . . . . . . . . . . . . . . 4.2.2.2 synchronous bit-oriented 4C4 . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3 mode selection 4C5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.4 receiver overview 4C6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.4.1 rx character length 4C7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.4.2 rx parity 4C8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.4.3 rx modem control 4C9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.5 transmitter overview 4C9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.5.1 tx character length 4C9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.5.2 tx parity 4C11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.5.3 break generation 4C11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.5.4 transmit modem control 4C11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.5.5 auto rts reset 4C11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.6 asynchronous mode operation 4C12 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.6.1 receiver operation 4C12 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.6.1.1 receiver initialization 4C12 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.6.1.2 framing error 4C12 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.6.1.3 break detection 4C13 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.6.1.4 clock selection 4C13 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.6.2 transmitter operation 4C13 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.6.2.1 transmitter initialization 4C13 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.6.2.2 stop bit selection 4C13 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.7 sdlc mode operation 4C14 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.7.1 receiver operation 4C14 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.7.1.1 flag detect output 4C14 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.7.1.2 receiver initialization 4C14 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.7.1.3 10x19-bit frame status fifo 4C14 . . . . . . . . . . . . . . . . . . . . . . . . 4.7.1.3.1 fifo enabling/disabling 4C15 . . . . . . . . . . . . . . . . . . . . 4.7.1.3.2 fifo read operation 4C15 . . . . . . . . . . . . . . . . . . . . . . . 4.7.1.3.3 fifo write operation 4C15 . . . . . . . . . . . . . . . . . . . . . . . 4.7.1.3.4 14-bit byte counter 4C15 . . . . . . . . . . . . . . . . . . . . . . . . 4.7.1.3.5 am85c30 frame status fifo operation clarification 4C18 . . . . . . . . . . . . . . . . . 4.7.1.3.6 am85c30 aborted frame handling when using the 10x19 frame status fifo 4C19 . . . . . . . . . . . . . . . . . . . . . . . . 4.7.1.4 address search mode 4C19 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.7.1.5 abort detection 4C20 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.7.1.6 residue bits 4C21 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.7.2 sdlc mode crc polynomial selection 4C21 . . . . . . . . . . . . . . . . . . . . . . . 4.7.2.1 rx crc initialization 4C22 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.7.2.2 rx crc enabling 4C22 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.7.2.3 crc error 4C22 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.7.2.4 crc character reception 4C22 . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.7.3 end of frame (eof) 4C26 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
data communication modes functional description amd 4C2 4.8 transmitter operation 4C27 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.8.1 transmitter initialization 4C27 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.8.2 mark/flag idle generation 4C27 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.8.3 auto flag mode 4C27 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.8.4 abort generation 4C28 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.8.5 auto transmit crc generator preset 4C28 . . . . . . . . . . . . . . . . . . . . . . . . . 4.8.6 crc transmission 4C28 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.8.7 auto tx underrun/eom latch reset 4C29 . . . . . . . . . . . . . . . . . . . . . . . . . . 4.8.8 transmitter disabling 4C29 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.8.9 nrzi mode transmitter disabling 4C29 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.9 sdlc loop mode 4C30 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.9.1 going on loop 4C30 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.9.1.1 on loop program sequence 4C31 . . . . . . . . . . . . . . . . . . . . . . . . . 4.9.1.2 on loop message transmission 4C31 . . . . . . . . . . . . . . . . . . . . . . 4.9.1.3 on loop transmit message programming sequence 4C31 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.9.2 going off loop 4C31 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.9.2.1 off loop programming sequence 4C32 . . . . . . . . . . . . . . . . . . . . . 4.9.3 sdlc loop initialization 4C32 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.9.4 sdlc loop nrzi encoding enabled 4C32 . . . . . . . . . . . . . . . . . . . . . . . . . . 4.10 synchronous mode operation 4C32 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.10.1 receiver operation 4C32 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.10.1.1 sync detect output 4C33 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.10.1.1.1 monosync mode 4C33 . . . . . . . . . . . . . . . . . . . . . . 4.11.1.2 bisync mode 4C33 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.10.1.2 sync character length 4C34 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.10.1.3 receiver initialization 4C34 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.10.1.4 sync character removal 4C34 . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.10.1.5 crc polynomial selection 4C36 . . . . . . . . . . . . . . . . . . . . . . . . . . 4.10.1.5.1 rx crc initialization 4C36 . . . . . . . . . . . . . . . . . . . . . 4.10.1.5.2 rx crc enabling 4C36 . . . . . . . . . . . . . . . . . . . . . . . . 4.10.1.5.3 rx crc character exclusion 4C36 . . . . . . . . . . . . . . . 4.10.1.5.4 crc error 4C37 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.10.2 transmitter operation 4C37 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.10.2.1 transmitter initialization 4C38 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.10.2.2 crc polynomial selection 4C38 . . . . . . . . . . . . . . . . . . . . . . . . . . 4.10.2.2.1 tx crc initialization 4C38 . . . . . . . . . . . . . . . . . . . . . . 4.10.2.2.2 tx crc enabling 4C38 . . . . . . . . . . . . . . . . . . . . . . . . 4.10.2.2.3 crc transmission 4C38 . . . . . . . . . . . . . . . . . . . . . . . 4.10.2.2.4 tx crc character exclusion 4C39 . . . . . . . . . . . . . . . 4.10.2.3 transparent transmission 4C39 . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.10.2.4 transmitter to receiver synchronization 4C39 . . . . . . . . . . . . . . . 4.10.2.4.1 transmitter disabling 4C40 . . . . . . . . . . . . . . . . . . . . . 4.10.2.5 external sync mode 4C40 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.10.2.5.1 sdlc external sync mode 4C41 . . . . . . . . . . . . . . . . 4.10.2.5.2 synchronous external sync mode 4C41 . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4C3 data communication modes functional description chapter 4 4.1 introduction the scc provides two independent full-duplex channels programmable for use in any common asynchronous or synchronous data communication protocol. this includes: asynchronous, synchronous monosync (8-bit sync character), synchronous bisync (16-bit sync character), normal sdlc, and sdlc loop mode. 4.2 protocols a communication protocol defines a set of rules for the orderly transfer of information be- tween two communicating devices. all communication line protocols in the industry today exchange data in either an asynchronous or synchronous manner. asynchronous trans- mission is used in several protocols including the tty protocol while synchronous trans- mission is used in protocols which include: ibm bisync, synchronous data link control (sdlc), high-level data link control (hdlc), and advance data communication con- trol procedures (adccp). this section provides a brief overview of these protocols; however, if further information is desired the book titled technical aspects of data communications by john e. mcnamara, published by digital press (dec) 1982, is a good reference. 4.2.1 asynchronous in asynchronous transmission, as the name implies, each character is transmitted as an independent entity; that is, the time between the last bit of one character and the first bit of another character can be variable. since the receiver must be able to detect the beginning of each character transmitted, this mode requires that at least one bit be added at the start and end of each character for synchronization purposes. synchronization at the receiver is accomplished by sensing the transition of the start-bit for each character transmitted. the first data bit of the character is typically sampled one and one-half bit times after the high-to-low transition of the start-bit, and each subse- quent bit is sampled one bit time thereafter. the sampling of the bit occurs near the cen- ter of each bit to allow correct data recovery and typically occurs at some multiple of the data rate. larger multiples allow a closer approximation to the middle sampling. figure 4C1 depicts a typical asynchronous 11-bit format. each 8-bit character is preceded by a start-bit and followed by a parity check bit and one stop-bit. the start-bit of the next character can occur anytime after the first characters stop-bit. the idle state of the trans- mission line between characters is always in a mark idle condition (i.e., txd pulled high). asynchronous communication channels are found in most distributed computer systems for terminal-to-computer comunications. the common serial port found on personal computers is an asynchronous port. it is used to attach external modems and printers, and to interface the personal computer to a minicomputer for use as a terminal. d7 x d6 x d5 x d4 x d3 x d2 x d1 x d0 x p x stop start d7 x d6 x d5 x d4 x d3 x d2 x d1 x d0 x p x stop start x = high or low figure 4C1. asynchronous format
data communication modes functional description amd 4C4 4.2.2 synchronous transmission synchronous transmission requires that clocking information be transmitted along with the data, either by a method of encoding data that contains clocking information, or by a modem that encodes clock information in the modulation process. in either case, data are sent at a defined rate which is controlled by a timing source at the transmitter. synchronous communication channels send data faster with less overhead than asyn- chronous channels but are more expensive to design than asynchronous channels. in synchronous communication, a timing reference, or clock, is used to control the transfer of information. this clock specifies to the receiver when to sample the data (bit synchroni- zation) in order to ascertain which data value (0 or 1) was transmitted. the optimum sample times usually correspond to the middle of the bit cell to minimize error. this clock signal is encoded along with the data sent so the receiver must be able to decode the figure 4C1. asynchronous format incoming clock signal. a circuit called a phase-locked loop is typically used for this purpose. in addition, since data rates are usually higher and data are typically sent with no gaps between characters, synchronous communication requires some level of buffering at both the transmitter and receiver. once bit synchronization has been established, the next phase for the receiver is to know what group of bits constitute a character (character synchronization). this requires that the receiver search the receive bit stream on a bit-by-bit basis for a character synchroniz- ing pattern in order to determine which set of bits in the bit stream defines the first char- acter transmitted. synchronous communication channels are found in many mainframe data networks. the greater throughput of the synchronous channel is required in mainframe environments where many terminals are connected to the computer and multiplexed onto one channel. the synchronous protocols used may be either character-oriented or bit-oriented. 4.2.2.1 synchronous character-oriented protocol in a character-oriented protocol (cop) data are transmitted in message blocks and re- quire that each block be preceded by either an 8- or 16-bit predefined sync character. in addition, cops are typically restricted to half-duplex operation and depend heavily on special control characters or character sequences, such as soh or dle stx and etx, to determine the start and end of a particular field within a message block. ibm bisync is an example of a cop. monosync, on the other hand, is a character count protocol where both ends of the communication link keep track of the number of characters sent and received. this solves the problem of having to use special control characters for field delineation as used in the bisync protocol. the ddcmp (digital data communication message protocol) from dec is another example of a character count protocol in use to- day. monosync and bisync message formats are shown in figures 4C2 and 4C3, re- spectively. since sync characters are only appended to the start of a message block, additional sync characters may be inserted within a transmission at distinct time intervals or during a pause in order to maintain synchronization. 4.2.2.2 synchronous bit-oriented bit-oriented protocols (bop) may be used in half- or full-duplex operation and are less dependent on special control characters. bops rely instead on the position of bits within specific fields. the most common bops in use today are high-level data link control (hdlc) and syn- chronous data link control (sdlc). these two protocols are nearly identical except for minor differences in the use of the address and control fields. all sdlc information is sent in frames and follow a standard format as shown in figure 4C4. sdlc frames begin and end with the 8-bit flag sequence, 01111110. all stations on the link search continuously for this flag sequence which indicates the start of a frame
data communication modes functional description amd 4C5 and provides the mechanism by which character synchronization is established at a re- ceiver. since data between flags may contain the flag pattern, the sequence of six con- secutive one bits is prevented from occurring through a process called zero-bit insertion, in which the transmitter inserts a zero bit after any five consecutive one bits. likewise, the receiver deletes any zero bit that follows five consecutive one bits in the bit stream be- tween the opening and closing flag of a frame. sync data crc figure 4C2. monosync format syn header text ext or etb bcc syn soh stx direction of serial data flow bcc = block checking calculation figure 4C3. bisync format beginning flag 01111110 8 bits address 8 bits frame check 16 bits control 8 bits information any number of bits frame ending flag 01111110 8 bits figure 4C4. sdlc/hdlc frame format the frame check sequence (fcs) is 16 bits long and contains the generated crc for the frame. all data transmitted between the opening and closing flags (excluding inserted zeros) are included in the crc calculation. the generator polynomial used in sdlc is the ccitt polynomial, x 16 + x 12 + x 5 + 1. since the information field may contain any number of bits and not necessarily an integral number of 8-bit characters, the end of a frame is determined by counting back 16 bits from the closing flag of a frame. in the sections that follow, the term synchronous mode(s) will be used to refer to either bisync and/or monosync modes, and sdlc mode will be used when referring to nor- mal sdlc operation. sdlc loop mode will be referred to as either loop mode or sdlc loop mode. 4.3 mode selection the mode that an scc channel operates in is selected by programming wr4 as shown below. note that the xs indicate a dont care condition (i.e., bit setting are ignored by scc) and ?s indicate programmable settings. note that bits d7 and d6 of wr4 are ignored in sdlc and synchronous modes because the x1 clock is forced internally.
data communication modes functional description amd 4C6 d7 x d6 x d5 1 d4 0 d3 0 d2 0 d1 ? d0 ? sdlc mode d7 x d6 x d5 0 d4 0 d3 0 d2 0 d1 ? d0 ? monosync mode d7 x d6 x d5 0 d4 1 d3 0 d2 0 d1 ? d0 ? bisync mode d7 ? d6 ? d5 x d4 x d3 d2 d1 ? d0 ? async mode 0 1 1 1 0 1 ?1 stop bit ?1 1/2 stop bits ?2 stop bits wr4 wr4 wr4 wr4 wr4mode settings 4.4 receiver overview the receiver performs all the functions necessary to convert serial data back to parallel for the processor. the receiver block diagram is shown in figure 4C5. serial data on the rxd pin is sampled on the rising edge of rtxc and passes through a one bit delay before either passing to the nrzi decode logic, or, depending on the mode, the receive sync register, 3-bit delay, or receive shift register. once a character has been assembled in the receive shift register it is transferred to the 3 x 8-bit receive data fifo, and the receive character available status bit in rr0 (d0) is set to alert the processor that a character is available. this arrangement creates a 3-byte delay time which allows the cpu time to service an interrupt at the beginning of a block of high- speed data. every character transferred to the receive data fifo is checked for errors, or special conditions, by the receive error logic. this status is loaded into the receive error fifo so that the status associated with each character can be read with that character through rr1. if receive interrupts are disabled then reading a character from the receive data fifo moves the next character and its status to the top of the fifo; so if status is needed for a character received, rr1 must be read prior to reading rr8 (receive buffer). if status is read after the data is read, the error data, if any, for the next character in the er- ror fifo will be included also. if, however, operations are being performed rapidly enough before the next character is received, then the status will be valid. however, if certain receive interrupts are enabled, the interrupt will not be generated until the charac-
data communication modes functional description amd 4C7 ter with the special condition is read from the data fifo. because under these condi- tions the fifo is locked, and prevented from being updated, the status pertinent to the character read will be valid until an error reset command is issued via wr0. 4.4.1 rx character length the number of consecutive bits assembled in the receive shift register that form a char- acter in all modes of operation is controlled by bits d7 and d6 of wr3. five, six, seven, or eight bits per character may be selected via these two bits. the data plus parity bit (if enabled) received are right-justified in the receive buffer as shown in figure 4C6. the scc merely takes a snapshot of the receive data stream at the appropriate times, so the unused bits in the receive buffer are only the bits following the character in the data stream. upper byte time constant lower byte time constant 16-bit down counter br generator input +2 10 x 19-bit frame status fifo receive data fifo receive error fifo br generator output receive error logic receive shift register (8 bits) 14-bit counter 3 bits sync register & zero delete hunt mode (disync) crc delay register (8 bits) crc checker crc result sync- crc sdlc-crc mux nrzi decode internal txd mux 1 bit rxd dpll dpll dpll output i/o data buffer cpu i/o internal data bus to transm i section figure 4C5. scc receiver
data communication modes functional description amd 4C8 d1 d0 p d4 d3 d2 d1 d0 figure 4C6. five bits/character with parity the character length may be changed at any time before the new number of bits have been assembled by the receiver. care should be exercised, however, as unexpected re- sults may occur if not properly timed. a representative example of switching from five bits to eight bits and back to five bits is shown in figure 4C7. 87654321 13 12 11 10 9 8 7 6 21 20 19 18 17 16 15 14 29 28 27 26 25 24 23 22 34 33 32 31 30 29 28 27 39 38 37 36 35 34 32 31 5 bits 8 bits 8 bits 5 bits 5 bits receive data buffer time change from five to eight change from eight to five figure 4C7. changing character length 4.4.2 rx parity in all modes of operation bit d0 (parity enable) of wr4 determines whether a parity check is done. if this bit is set to 1, the receiver calculates a parity check on every char- acter received, as selected by bit d1 (parity even/odd) of wr4, and compares it with parity check bit transmitted. if a discrepancy is found the parity error status bit in the re- ceive error fifo is set at the same time that the character is transferred to the receive data fifo; otherwise, the character received will be assumed to be error free. the additional bit per character will be visible in the receive data fifo if the data plus parity is eight bits or less. the parity bit will not be visible when there are eight data bits per character.
data communication modes functional description amd 4C9 the parity error bit in the receive error fifo may be programmed to cause a special condition interrupt by setting bit d2 of wr1 to 1. if this interrupt mode is programmed, and a parity error is detected, an interrupt will not be generated until the character asso- ciated with the parity error is read from the receive data fifo. this, or any, special condition interrupt locks up the data fifo, and the parity error bit remains latched until an error reset command is issued by the processor via wr0. if interrupts are not being used to transfer data (i.e., receive interrupts disabled mode) an interrupt will not be generated and any error status must be obtained by polling rr0, or reading rr2 (channel b). in this case, if status is to be checked, it must be done be- fore the data are read, because the act of reading the data moves the next character and status to the top of the data and error fifos. note that parity is normally not used in sdlc modes. 4.4.3 rx modem control the scc provides up to three modem control signals associated with the receiver in asynchronous mode, and two in sdlc and synchronous modes. in asynchronous mode, the sync pin is a general-purpose input whose state is reported via the sync/hunt status bit in rr0; however, if the crystal oscillator is enabled, this pin is not available and the sync/hunt status bit is forced to 0. otherwise, the sync pin may be used to carry the ring indicator signal. in sdlc and synchronous modes, except for external sync mode, the sync pin is configured as an output. the dtr /req pin carries the inverted state of the dtr bit in wr5 (d7) unless this pin has been programmed to carry a dma request signal. the dcd pin is ordinarily a gen- eral purpose input to the dcd status bit in rr0. however, if the auto enables mode is selected (by setting d5 of wr3 to 1), this pin becomes an enable for the receiver. that is, if auto enables is on and the dcd pin is high the receiver will be disabled; while the dcd pin is low the receiver will be enabled. note, however, that in all modes of opera- tion, the receiver enable bit must be set before the dcd pin can be used in this manner. 4.5 transmitter overview the transmitter performs all the necessary functions to convert parallel data from the processor into the appropriate serial bit streams. the transmit data path is shown in fig- ure 4C8. the transmitter has an 8-bit transmit data register (wr8) which is loaded from the inter- nal data bus, and a transmit shift register which is loaded from either wr6, wr7, or the transmit data register (wr8). serial data transitions on the falling edge of trxc begin when data written to wr8 are transferred to the transmit shift register. each time a character is transferred from wr8 into the transmit shift register a transmit buffer empty indication is given via bit d2 of rr0. this double buffering allows the processor one full character time to respond with the next character without interrupting data transmission. in all modes of operation, data will be sent low-order bits first (i.e. d0 before d1, etc.) for as many bits as programmed. this requires that data written to the transmit buffer be right-justified if character length is less than eight bits. 4.5.1 tx character length the number of bits transmitted per character and the way the data are formatted within the transmit buffer is controlled by bits d6 and d5 of wr5. these bits provide the option of five, six, seven, or eight bits per character. being able to transmit less than five bits per character is possible on the scc if the five bits per character length is programmed and the data are formatted before being written to the transmit buffer, as shown in table 4C1, to inform the scc of the actual number of bits to be transmitted.
data communication modes functional description amd 4C10 wr7 sync register wr6 sync register transmit data 20-bit transmit shift register start bit transmit mux & 2-bit delay zero insert (5 bits) crc generator nrzi encode final tx mux txd internal txd transmit clock to other channel async sync sdlc crc-sdlc internal data bus figure 4C8. scc transmitter table 4C1. data formatfive bits or less bits d7 d6 d5 d4 d3 d2 d1 d0 transmitted 1111000d0 1 bit 111000d1d0 2 bits 11000d2d1d0 3 bits 1000d3d2d1d0 4 bits 0 0 0 d4 d3 d2 d1 d0 5 bits the serial data stream sent by the transmitter for the six bits/character with parity case is shown below in figure 4C9. all the unused bits are ignored by the transmit logic except in the case of five bits per character. d0 p d5 d4 d3 d2 d1 d0 p data flow figure 4C9. six bits/character with parity
data communication modes functional description amd 4C11 the character length may be changed at any time, but the desired length must be se- lected before the character in the transmit buffer is transferred to the the transmit shift register. the easiest way to ensure this is to write to wr5 to change the character length before writing the data to the transmit buffer. 4.5.2 tx parity in all modes of operation bit d0 (parity enable) of wr4 determines whether an additional bit will be appended to each character sent as an indication of the oddness or even- ness of the number of 1 bits transmitted in the character. if this bit is set to 1 an addi- tional bit will be sent in addition to the number of bits specified in wr4, or by the data for- mat used when transmitting less than five bits per character. bit d1 of wr4 determines the even/odd sense of this additional bit when parity is en- abled. if this bit is set to 1, the transmitter adds a bit that makes the total number of 1 bits in the character being transmitted even; if set to 0, a bit will be added to make the sum of 1 bits in the character being transmitted odd. 4.5.3 break generation the transmitter may be programmed to send a break condition (i.e., the txd pin is pulled low) in all modes of operation via bit d4 of wr5. when this bit is set to 1, the transmit- ter suspends any data being transmitted at the time and sends continuous 0s from the first transmit clock edge after this command is issued, until the first transmit clock edge after this bit is reset, at which point the transmitter continues to send the contents of the transmit shift register. the transmit clock edges referred to here are those that define transmitted bit cell boundaries. note that the txd pin will be pulled low whether or not the transmitter is enabled. 4.5.4 transmit modem control there are two modem control signals associated with the transmitter on the scc. the rts pin is a general-purpose output that carries the inverted state of the rts bit in wr5 (d1), and the cts pin is a general-purpose input to the cts status bit in rr0 (d5). how- ever, if the auto enables mode is selected (by setting d5 of wr3 to 1), cts becomes an enable for the transmitter. that is, if auto enables is on and the cts pin is high the transmitter will be disabled; while the cts pin is low the transmitter will be enabled. note, however, that in all modes of operation, the transmitter enable bit must be set be- fore the cts pin can be used in this manner. if the scc channel is programmed in asynchronous mode, and the auto enable bit is set to 1, rts will remain low until the transmitter is completely empty and the last stop bit has left the txd pin. in sdlc and synchronous modes, the rts pin is just a general- purpose output. 4.5.5 auto rts reset on the cmos scc, if bits d0 of wr15 and d2 of wr7 are set to 1 and the channel is in sdlc mode, the rts pin may be reset early in the tx underrun routine and the rts pin will remain active until the last zero bit of the closing flag leaves the txd pin as shown in figure 4C10. note that in order for this to function properly, bits d3 and d2 of wr10 must be set to 1 and 0, respectively.
data communication modes functional description amd 4C12 crc crc flag data being sent tx underrun/eom rts bit d1 wr5 rts pin (active low) data figure 4C10. rts deactivation 4.6 asynchronous mode operation 4.6.1 receiver operation in asynchronous mode, the receiver establishes bit and character synchronization by sensing the high-to-low transition of the start-bit for each character. when the start-bit is detected a clock circuit is initiated and the receiver waits one-half a bit time before sam- pling rxd again to ensure that rxd is still low. if rxd is low, the receiver assumes that it is the middle of the start-bit and one bit time later begins to assemble the specified number of data and parity (if enabled) bits. during reception, the start and stop bits are stripped leaving only the data and parity (if enabled and with less than 8 bits/character option selected). once the character is assembled, the receiver samples rxd one more bit time. if rxd is low, the framing error bit is set and is passed to the receive error fifo at the same time the character is transferred to the receive data fifo. if the rxd is high, the receiver returns to the quiescent marking state until the next high-to-low transition is detected on the rxd pin. in this mode, serial data enters the 3-bit delay if the character length of seven or eight bits is selected. if a character length of five or six bits is selected, data enters the receive shift register directly. 4.6.1.1 receiver initialization the initialization sequence for the receiver in asynchronous mode is: wr4 first to select the mode, then wr3 and wr5 to select the various options. at this point, the other regis- ters should be initialized as necessary. when all of this is complete the receiver may be enabled by setting bit d0 of wr3 to 1. 4.6.1.2 framing error if after assembling the selected number of bits per character the receiver finds the stop bit to be a 0, the framing error bit in the receive error fifo is set at the same time that the character is transferred to the receive data fifo. this error bit accompanies the data to the top of the fifo, where it generates a special condition interrupt (if enabled). this framing error bit is not latched, and so must be read in rr1 before the accompany- ing data is read in the receive data fifo. detection of a framing error adds an addi- tional one-half bit to the character time so that the framing error is not interpreted as a new start bit.
data communication modes functional description amd 4C13 4.6.1.3 break detection a break condition is recognized when a null character (all 0s) plus a framing error is detected by the receiver. upon recognizing this sequence, the break/abort status bit in rr0 will be set and remains set until a 1 is received indicating that a break condition is no longer present. note that at the termination of a break, the receive data fifo con- tains a single null character, which should be read and discarded. the framing error bit will not be set for this null character, but if odd parity has been selected, the parity error bit will be set. caution should be exercised if the receive data line contains a switch that is not debounced to generate breaks. switch bounce may cause multiple breaks, recog- nized by the receiver to be additional characters assembled in the receive data fifo. it may also cause a receiver overrun condition to be latched. 4.6.1.4 clock selection when an scc channel is programmed in asynchronous mode it may be programmed to accept a transmit/receive clock that is 1, 16, 32, or 64 times the data rate. this is selected by bits d7 and d6 in wr4. the clock factor chosen will be common to both the transmit- ter and receiver. the x1 mode in asynchronous mode is a combination of both synchronous and asynchro- nous transmission. the data are clocked by a common timing base, but characters are still framed with start and stop bits. because the receiver waits for one clock period after detecting the first high-to-low transition before beginning to assemble characters, the data and clock must be synchronized externally. the x1 mode is the only mode in which a data encoding method other than nrz may be used. in sdlc and synchronous modes bits d7 and d6 of wr4 are ignored because the x1 clock is forced internally. 4.6.2 transmitter operation in asynchronous mode, wr6 and wr7 are not used and the transmit shift register is formatted with start and stop bits before data are shifted out to the transmit multiplexer at the selected clock rate. asynchronous data leaves the transmit shift register and goes directly to the transmit multiplexer. crc generation is not supported in this mode. 4.6.2.1 transmitter initialization the initialization sequence for the transmitter in asynchronous mode is: wr4 first to se- lect the mode, then wr3 and wr5 to select the various options. at this point the other registers should be initialized as necessary. when all of this is complete, the transmitter may be enabled by setting bit d3 of wr5 to 1. at this point, the transmitter is enabled and the txd pin will remain in the marking (high) state. when the first character is written to wr8, it is transferred to the transmit shift register and the transmit buffer empty bit is set to 1. a parity bit (if enabled), start-bit, and the selected number of stop bits are then appended to the character. after the char- acter has been completely sent, the next character is transferred to the transmit shift register and the process continues. when no more characters are to be transmitted (i.e., the transmitter is completely empty), the all sent status bit in rr1 (d0) will be set when the last stop bit reaches the txd pin. this bit can be used by the processor as an indica- tion that the transmitter may be safely disabled. the txd pin then remains in the marking state until the next character is written to wr8. 4.6.2.2 stop bit selection the scc provides three stop-bit options via bits d3 and d2 in wr4. the options avail- able are one, one-and-a-half, or two stop bits per character. these two bits in wr4 select only the number of stop bits for the transmitter, as the receiver always checks for one stop bit. note that the selected clock factor may restrict the number of stop bits that may be transmitted. in particular, when the clock rate and data rate are the same (i.e., x1 mode), one-and-a-half stop bits are not allowed. if any length other than one stop bit is desired in the x1 mode, only two stop bits can be used.
data communication modes functional description amd 4C14 4.7 sdlc mode operation 4.7.1 receiver operation receiver operation in sdlc mode begins in a hunt mode where the communications line is monitored for a synchronizing pattern on a bit-by-bit basis. the receiver may be placed in hunt mode by having the processor issue the enter hunt mode command via bit d4 in wr3, but will always start out in hunt mode when it is enabled. the enter hunt mode bit in wr3 is a command so writing a 0 to it has no effect. the hunt status of the receiver is reported by the sync/hunt status bit in rr0. in sdlc mode, this status bit will be set to 1 when either; 1) the processor issues the enter hunt mode command, 2) the processor disables the receiver, or 3) an abort is detected. it will be reset to 0 when the receiver leaves hunt mode, or when the abort condition goes away. unlike bisync or monosync mode, once the sync/hunt status bit is reset it does not need to be set again in between frames because the receiver always maintains synchronization. this sync/hunt status bit is one of the possible sources of external/status interrupts, with both transitions causing an interrupt. this is true even if the sync/hunt bit is set as a result of the processor issuing the enter hunt mode command. while in hunt mode the receive sync register and wr7 are used in establishing char- acter synchronization. as data are received, the receiver searches for the bit pattern, 01111110, programmed in wr7. this sequence of six consecutive 1 bits is prevented from occurring randomly elsewhere in the frame through a process called zero-bit inser- tion in which the transmitter inserts a 0 bit after five consecutive 1 bits, irrespective of character boundaries. in turn, the receiver always searches the receive data stream on a bit-by-bit basis for five consecutive 1s. when the receiver detects a 0 bit followed by five 1 bits, it inspects the following bit. if it is a 0, the one bits are passed as data and the zero bit is deleted. if the sixth bit is a 1, the receiver inspects the seventh bit. if it is a 0, a flag has been encountered and the receiver is synchronized to that flag; if it is a 1 an abort or an eop (end of poll) has been encountered. when a flag is detected and address search mode is not enabled, the receiver leaves hunt mode and character assembly begins with the first non-flag character. once charac- ter assembly begins characters are assembled according to the number of bits per char- acter specified until: 1) an end of frame flag is detected, 2) an abort pattern is detected, 3) the receiver is disabled, or 4) a channel or hardware reset is executed. all data passes through the receive sync register and the 3-bit delay before entering the receive shift register once synchronization is achieved. ordinarily, the receiver transfers all data between flags to the receive data fifo, but while it is in hunt mode no flags will be transferred. 4.7.1.1 flag detect output in sdlc mode, if bit d7 of wr11 is set to 0, the sync pin will be configured as an out- put and the scc will drive it low every time a flag pattern is detected in the data stream. the timing for the sync signal is shown in figure 4C11. 4.7.1.2 receiver initialization the initialization sequence for the receiver in sdlc mode is: wr4 first, to select the mode, then wr10 to modify it if necessary, wr6 to program the address, wr7 to pro- gram the flag and wr3 and wr5 to select the various options. at this point the other reg- isters should be initialized as necessary. when all of this is complete, the receiver may be enabled by setting bit d0 of wr3 to 1. 4.7.1.3 10x19-bit frame status fifo in addition to the 8-bit receive data and error fifos, the cmos scc receiver incorpo- rates a 14-bit receive byte counter and a 10x19-bit fifo array for storing frame status for up to ten frames. this fifo enhances the sccs ability to receive high speed back-to-
data communication modes functional description amd 4C15 back sdlc frames by minimizing frame overruns due to cpu latencies in responding to interrupts. the block diagram of the 10x19-bit fifo is shown in figure 4C12. 4.7.1.3.1 fifo enabling/disabling this frame status fifo is enabled through wr15 bit d2 but only when the scc is pro- grammed in sdlc mode. since each channel incorporates this fifo, each can be en- abled and disabled independently. resetting bit d2 of wr15 disables and resets the fifo. table 4C2 tabulates the ena- bling/disabling of channel fifos. note that the fifo pointer logic is reset when d2 of wr15 is reset or after a power-on reset. when the frame status fifo is disabled, the cmos scc is completely downward com- patible with the nmos scc, and the status register contents bypass the fifo and go directly to the bus interface as shown in figure 4C12. the status of the fifo enable signal can be obtained by reading bits d2 of rr15 through their respective channels. if the fifo is enabled, this bit will be set to 1; otherwise, it will be set to 0. 4.7.1.3.2 fifo read operation to facilitate the use of these fifos, two new registers were added. these registers, rr6 and rr7, are accessible only when bit d2 of wr15 is set to 1, and the scc is pro- grammed in sdlc mode. table 4C2. frame status fifo enabling wr15a(d2) wr15b(d2) operation 0 0 ch.a and ch.b fifos disabled and reset 1 0 ch.a and ch.b fifos enabled but not independent (resetting d2 or wr15a resets both fifos simultaneously) 1 1 ch.a and ch.b fifos enabled and independent (resetting d2 in either channel resets only pertinent fifo) 0 1 ch.b fifo enabled only rtxc rxd sync flag lastC1 flag last data 0 data 1 data 2 figure 4C11. flag detect timing
data communication modes functional description amd 4C16 scc status reg (existing) 14-bit byte counter residue bits(3) overrun crc error 14 bits 6 bits 10 x 19-bit fifo array 5 bits eof = 1 en 6 bits rr1 2 bits interface to scc 6-bit mux bit 7 bit 6 6 bits bits 0-5 rr7 rr6 8 bits byte counter contains 14 bits for a 16-kbyte maximum count fifo data available status bit status bit set to 1 when reading from fifo fifo overflow status bit msb of rr(7) is set on status fifo overflow in sdlc mode the following definitions apply ?all sent bypasses mux and equals contents of scc status register ?parity bits bypasses mux and does the same ?eof is set to 1 whenever reading from the fifo reset on flag detect increment on byte det enable count in sdlc tail pointer 4-bit counter head pointer 4-bit counter 4-bit comparator over equal wr(15) bit 2 set enables status fifo fifo enable end of frame signal status read comp rr1 figure 4C12. 10x19-bit frame status fifo when this fifo is enabled, rr6 accommodates the lsb byte count from the 14-bit byte counter and rr7 accommodates the msb byte count along with fifo availability and overflow status. figure 4C13 shows the details of these registers including wr15. if frame status is to be acquired from the 10x19-bit fifo, it must be enabled and not empty, and the registers must be read in the following order: rr7, rr6, and rr1 (read- ing rr6 is optional). accessing rr7 latches the fifo empty/full status bit (d6 of rr7) and steers the status multiplexer to read from the 10x19-bit fifo array instead of from the 8-bit status fifo. reading rr1 immediately after rr7 causes one location of the fifo to be emptied, so status should be read after reading the byte count; otherwise, the count will be incorrect. if the fifo goes empty when rr1 is read, the fifo is disabled and the next read of rr1 will be directly from the 8-bit status fifo, and reads from rr7 and rr6 will contain bits that are undefined. to determine if status data is coming from the 10x19-bit fifo or di- rectly from the status register the user should check bit d6 of rr7. if this bit is set to 1 the fifo is not empty; if set to 0 the fifo is empty.
data communication modes functional description amd 4C17 since not all status bits of rr1 are stored in the frame status fifo, the all sent, parity, and eof bits bypass the fifo and are stored in the 8-bit status fifo. the status bits stored in the 10x19-bit fifo will be the residue, overrun, and crc status bits. note that the eof interrupt is generated the same way as before. 4.7.1.3.3 fifo write operation when an eof is detected, and the fifo is enabled, the five status bits and byte-count are loaded into the fifo, and the fifo pointer is incremented. if the fifo overflows, bit d7 of rr7 (fifo overflow) is set to indicate the overflow. this bit and the fifo control logic is reset by disabling and re-enabling the fifo control bit (wr15 bit d2). for details of fifo control timing during an sdlc frame, refer to figure 4C14. when a packet is completely received, then a receive interrupt on special condition is generated upon receipt of the end of frame flag. if the clock is temporarily stopped after the receipt of the flag, the frame status fifo may not be updated even though the inter- rupt was generated. at least two receive clocks are needed to update the frame status fifo. the frame status information is not lost and will be put into the frame status fifo when the clock is enabled again. 4.7.1.3.4 14-bit byte counter the 14-bit byte counter allows for data frames of up to 16k bytes to be received. it is en- abled when bit d2 of wr15 is set to 1 and the scc is in sdlc mode. it is reset when- ever an sdlc flag character is received. the reset is timed so that the contents of the byte counter are successfully written into the fifo. the byte counter is incremented by writes to the 8-bit receive data fifo. the counter represents the number of bytes received by the scc, rather than the number of bytes transferred from the scc. (these counts may differ by up to the number of bytes in the receive data fifo contained in the scc.) foy fda bc 13 6 5 7 fifo data available status 1 = status reads will come from fifo 0 = status reads will come from scc fifo overflow status 1 = fifo overflowed during operation 0 = normal rr7 0 bc 0 read from fifo lsb byte count rr6 4 bc 12 3 bc 11 2 bc 10 1 bc 9 0 bc 8 7 bc 7 6 bc 6 5 bc 5 4 bc 4 3 bc 3 2 bc 2 1 bc 1 0 * status fifo enable control bit 1 = wr16 7 * 6 * 5 * 4 * 3 * 2 fen 1 * status and byte count will be held in the status fifo until read 0 = status will not be held (scc)t (emulation mode) * = no change from nmos scc dfn 10216a-013a figure 4C13. frame status fifo registers
data communication modes functional description amd 4C18 f a d d d d c c f 0 1 2 3 4 5 6 7 f a d d d d c c f 0 1 2 3 4 5 6 7 0 internal byte strobe increments counter internal byte strobe increments counter don't load counter on 1st flag reset byte counter here reset byte counter load counter into fifo and increment ptr reset byte counter reset byte counter load counter into fifo and increment ptr 10216a-012a figure 4C14. frame status fifo control timing 4.7.1.3.5 am85c30 frame status fifo operation clarification in an effort to make the 10x19 frame status fifo (fsf) useful for high-speed reception of packets, the lock on the 3-byte receive fifo that occurs after special conditions in two of the receive interrupt modes was removed. the benefit of this operation is that the user can receive multiple frames of sdlc data before having to service the interrupt. competi- tion 85c30 freezes the rx fifo after every frame, so the user could lose frames of data between the end of the first frames and reset error command. in this case the user must service interrupts for every frame of data on the competition 85c30, defeating the pur- pose of the fifo. amd allows the user to receive up to 10 frames of data before having to service the interrupt, thus obtaining the maximum (desired) utilization of the fsf. a clarification of the enhanced operation is given below. the removal of the lock on the receive data 3-byte fifo affects the device when it is programmed in the interrupt on first receive character of special condition or interrupt on special condition only modes. 1. when the 10x19 frame status fifo (fsf) is not enabled, the 3-byte receive fifo (rx fifo) locks when a special condition is received until the reset error command is issued. dma is disabled when the rx fifo locks until the reset error command is issued (same as old operation). 2. when the fsf is enabled: a. the 3-byte receive fifo never locks. b. dma is disabled only on overrun (i.e. overruns do not lock the rx fifo, but do disable dma). to reenable dma after an overrun, the following sequence must be used: i. read and discard all entries in the receive data 3-byte fifo. ii. issue the error reset command. iii. note that if an additional byte of data is received between the time that the receive data fifo is emptied and the error reset command is issued. dma will not unlock. this signals the user that corrupt data remains in the receive data fifo. the user must read and discard all entries in the receive data 3-byte before dma will reenable. note that an additional error reset is not required. c. interrupts are generated and remain active until the reset error command is issued. d. interrupt vectors (in read register 2b) are modified as follows. there are two bit patterns for receiver interrupts, x11-special receive condition, and x10 receive character available. refer to figure 3C2 (page 3C6) and table 6C4 (page 6C19) of this manual.
data communication modes functional description amd 4C19 i. the status x11 will be reported when the first special conditions is received. ii. as more data is received, the status will switch to x10 to reflect that a receiver interrupt has been received, but that the present data in the receive data 3-byte fifo does not contain a special condition. iii. when a special condition resides at the top of the receive data fifo, the status x11 will be reported. 4.7.1.3.6 am85c30 aborted frame handling when using the 10x19 frame status fifo field feedback on the am85c30 frame status fifo has revealed that neither amd nor competition create an entry in the frame status fifo when a frame being received is aborted (seven or more consecutive 1s appear in the receive data stream). an aborted frame indicates to the receiver that synchronization has been lost. the receiver then en- ters hunt mode where it monitors the input data stream until a sdlc flag is recognized. after an sdlc flag is received, the receiver is capable of receiving additional data frames. because of the lack of an entry in the frame status fifo for aborted frames, the receiver cannot look only at the frame status fifo to determine the exact nature of all data re- ceived. to properly recognized and recover from aborted frames, the following practice is recommended: 1. the receiver must enable an external/status interrupt on abort. 2. when an interrupt due to an abort is received, all frames contained in the frame status fifo should be considered to be corrupted and discarded. the processor should request re-transmission of these frames. 3. note that an external/status interrupt will be generated both when an abort is received and when the abort condition disappears. either transition of the abort status will cause the abort bit in read register 0 to latch until a reset external/ status interrupt command is issued through write register 0. this behavior is identical on both competition and amd product and is not revision de- pendent. 4.7.1.4 address search mode the first 8-bit non-flag character following the opening flag of a frame is assumed by the scc to be the address of the station for which the frame is intended. the scc provides several options for handling this address via bits d2 (address search mode) and d1 (sync character load inhibit) of wr3. if the address search mode is enabled, the receivers address recognition logic will be enabled and the receiver will compare the first 8-bit non-flag character with the contents of wr6. if these two characters match, or if the received character is the global address (all 1s), data are passed to the receive shift register and character assembly begins. if no match is detected the receiver remains in hunt mode and no data are passed to the receive shift register. the global address is used in applications where a specific station address is not known, as might be the case in a switched connection, or when a broad- cast frame is sent to all stations. address search mode will be enabled when wr3 is pro- grammed as shown below. ????x10? d7 d6 d5 d4 d3 d2 d1 d0 wr3register layout
data communication modes functional description amd 4C20 the address comparison will be across all eight bits of wr6 when the sync character load inhibit bit (d1 in wr3) is set to 0. this comparison may be modified so that only the four most significant bits of wr6 must match the received address. this mode is se- lected by programming wr3 as shown below. ????x11? d7 d6 d5 d4 d3 d2 d1 d0 wr3register layout in this mode, however, the address field is still eight bits wide. regardless of the mode enabled, the address field is not treated differently than data and is always transferred to the receive data fifo in the same manner as data. note that address search mode is available only in sdlc mode. sdlc address search mode (bit d2 in write register 3 is set) and receive full crc mode (bit d5 of write register 7 ) should not be used in conjunction with each other. if these modes are used together, the am85c30 will accept all packets with addresses that match the address programmed into register 6 and will accept only the address byte of the packet with addresses that do not match the register 6 address. proper operation of address search mode calls for the complete rejection of packets with addresses that do not match the register 6 address. 4.7.1.5 abort detection in addition to monitoring the data stream for flags, the receiver also monitors the line for an abort pattern. an abort is detected when seven consecutive 1s are found in the data stream. this is usually an indication sent by the transmitter alerting the receiver that the frame currently being received has been aborted and should be discarded. the detection of an abort is reported in the break/abort status bit in rr0 (d7). this status bit is one source of external/status interrupts, so transitions of this status bit may be programmed to cause interrupts. an abort automatically forces the receiver into hunt mode and sets the sync/hunt status bit in rr0 (d4) to 1. because this status bit is also a possible external/status con- dition, its transition may also be programmed to cause an interrupt. thus transitions on both the break/abort and sync/hunt status bits may occur very close together, and either one or two external/status interrupts may result. the break/abort status bit will be reset when a 0 is received, either by the abort it- self going away or as the leading 0 of a flag. in either case, the sync/hunt status bit will remain set until the receiver leaves hunt mode. because both transitions on the break/abort status bit are guaranteed to cause an interrupt, two discrete external/ status interrupts will occur; one when the abort is detected and one when the abort goes away. note that the scc does not discriminate between an in-frame (between opening and closing flags) and an out-of-frame (after eof) abort. an abort detected while the receiver is in-frame terminates frame reception, but not in an orderly manner, because the char- acter being assembled is lost and the receive data fifo is not flushed. an out-of-frame abort interrupt will be generated approximately seven bit times after eof has been de- tected if the transmitter mark idles. if an abort is detected by the receiver after the clos- ing flag and eight 1s have been received, the abort will persist until another flag is de- tected at which time the receiver exits from hunt mode. if an out-of-frame interrupt is to be avoided it should be disabled early in the eof interrupt routine. because the break/ abort status bit is not latched in rr0, it may happen that this status bit will be reset by the time the software responds to the interrupt, causing yet another interrupt. in this case, unless the dcd pin has been programmed as the receiver auto enable, the sync/hunt
data communication modes functional description amd 4C21 status bit may be able to provide the indication that an abort pattern was received, since an abort condition places the receiver in hunt mode. 4.7.1.6 residue bits since the information field of an sdlc/hdlc frame can contain any number of bits and not necessarily an integral number of 8-bit characters, the end of data is determined by counting back 16 bits from the closing flag of a frame. the scc provides three residue bits that can be used to indicate the boundary between the data and crc characters in the last few bytes read from the receive data fifo. the meaning of these residue bits with each character length option is shown in table 4C3. in this table previous byte re- fers to the character received prior to the end of frame flag being detected. the residue code bits are not loaded through the top of the receive error fifo. they change in rr1 when the last character of the frame is loaded into the receive data fifo. if there are any characters already in the data fifo, the residue code will not be valid until the eof status bit is set in rr1. 4.7.2 sdlc mode crc polynomial selection crc error checking is done with a 16-bit crc character inserted between the end of the data field and the end of frame flag. in synchronous modes, a control character is usually used to signify when an end of message has been received (i.e., etx, eot, etc.). this control character comes before the crc characters; so on reception, the crc calculation can be stopped and the transmitted crc characters are compared with the crc charac- ters generated by the receiver. this cannot be done in sdlc mode, since the end of frame flag is after the crc characters. in order to use the same core hardware configura- tion already used in synchronous modes, sdlc mode requires that the transmit crc generator be preset to all 1s, and the complement of the crc result be transmitted. on reception, the receive crc generator must also be preset to all 1s and, when the end of frame flag is detected, the result is checked against the bit pattern 0001110100001111 to ascertain frame integrity. this is consistent with other bit-oriented protocols, such as hdlc and adccp. table 4C3. residue codes 0 1 2 8b/c 7b/c 6b/c 5b/c 8b/c 7b/c 6b/c 5b/c 8b/c 7b/c 6b/c 5b/c 100 0000 310 2 8857 010 0000 420 0 8863 110 0000 531 0 8874 001 0000 642 0 8885 101 0000 753 1 8886 011 000C 064 C 888C 111 00CC 10C C 87CC 000 0CCC 2CC C 8CCC residue code data bits in previous byte data bits in second byte data bits in third byte
data communication modes functional description amd 4C22 because the bit pattern used by the receiver for crc error checking is based on an in- dustry standard polynomial, only the crc-ccitt polynomial (x 16 +x 12 +x 5 +1) can be used in sdlc mode. the crc transmission and crc-ccitt polynomial are enabled by programming wr5 as shown below. ?????0?1 d7 d6 d5 d4 d3 d2 d1 d0 wr3register layout 4.7.2.1 rx crc initialization bit d7 of wr10 controls the initial state of both the transmit and receive crc generators. although the transmit and receive generators may be preset to either all 0s or all 1s, sdlc operation requires that this bit be set to 1 for proper error detection. the receive crc generator will be automatically preset whenever the receiver is in hunt mode, or a flag is detected so a reset crc checker command should not be necessary. it may, however, be preset whenever necessary by issuing this command in wr0. 4.7.2.2 rx crc enabling in sdlc mode, the scc always calculates crc on all bits, except inserted zeros, be- tween the opening and closing flags of a frame, so the rx crc enable bit in wr3 (d3) is ignored. 4.7.2.3 crc error when the end of frame flag is detected, the crc error bit is loaded into the receive error fifo at the same time the character in the receive shift register is transferred to the receive data fifo. since this crc error status bit is not latched internally, it will usually always be set to 1 in rr1, since most bit combinations, except for a correctly completed frame, result in a non-zero crc. hence, the crc error bit should not be considered valid until the eof status bit is set to 1 in rr1, and should be ignored at all other times. 4.7.2.4 crc character reception on the nmos scc, when the end of frame flag is detected the contents of the receive shift register are transferred to the receive data fifo regardless of the number of bits accumulated. because of the 3-bit delay between the receive sync register and re- ceive shift register, the last two bits of the crc check character received are never transferred to the receive data fifo. thus, the received crc characters are unavailable for use. on the cmos scc, the option of being able to receive the complete crc characters generated by the transmitter is provided when both bits d0 of wr15 and bit d5 of wr7 are set to 1. when these two bits are set and an end of frame flag is detected, the last two bits of the crc will be clocked into the receive shift register before its contents are transferred to the receive data fifo. the data-crc boundary and crc character bit formats for each residue code provided are shown in figures 4C15 through 4C18 for each character length selected.
data communication modes functional description amd 4C23 d c 0 d d d d c 0 c 1 c 2 c 1 c 2 c 3 c 4 c 5 c 6 c 7 c 5 c 6 c 7 c 8 c 9 c 10 c 11 c 12 c 8 c 9 c 10 c 11 c 12 c 13 c 14 c 15 residue code 0 1 2 0 0 1 d d d d d c 0 c 1 c 0 c 1 c 2 c 3 c 4 c 5 c 6 c 4 c 5 c 6 c 7 c 8 c 9 c 10 c 11 c 8 c 9 c 10 c 11 c 12 c 13 c 14 c 15 residue code 0 1 2 1 0 1 d d d d d d c 0 c 0 c 1 c 2 c 3 c 4 c 5 c 3 c 4 c 5 c 6 c 7 c 8 c 9 c 10 c 8 c 9 c 10 c 11 c 12 c 13 c 14 c 15 residue code 0 1 2 1 0 0 d d d d d c 0 c 1 c 2 c 3 c 4 c 2 c 3 c 4 c 5 c 6 c 7 c 8 c 9 c 7 c 8 c 9 c 10 c 11 c 12 c 13 c 14 residue code 0 1 2 0 1 0 d d d d d c c c c c c c c 8 9 10 11 12 13 14 15 d d d d d c 0 c 1 c 2 c 3 c 1 c 2 c 3 c 4 c 5 c 6 c 7 c 8 c 6 c 7 c 8 c 9 c 10 c 11 c 12 c 13 residue code 0 1 2 1 1 0 d d d c c c c c c c c 8 9 10 11 12 13 14 15 d d d d d d d d d d 10216a-015a figure 4C15. five bits/character
data communication modes functional description amd 4C24 d c 0 d d d d c 0 c 1 c 1 c 2 c 3 c 4 c 5 c 6 c 7 c 6 c 7 c 8 c 9 c 10 c 11 c 12 c 13 c 8 c 9 c 10 c 11 c 12 c 13 c 14 c 15 residue code 0 1 2 0 1 0 d d d d d c 0 c 0 c 1 c 2 c 3 c 4 c 5 c 6 c 5 c 6 c 7 c 8 c 9 c 10 c 11 c 12 c 8 c 9 c 10 c 11 c 12 c 13 c 14 c 15 residue code 0 1 2 1 1 0 d d d d d d c 0 c 1 c 2 c 3 c 4 c 5 c 4 c 5 c 6 c 7 c 8 c 9 c 10 c 11 c 8 c 9 c 10 c 11 c 12 c 13 c 14 c 15 residue code 0 1 2 0 0 1 d d d d d c 0 c 1 c 2 c 3 c 4 c 3 c 4 c 5 c 6 c 7 c 8 c 9 c 10 c 8 c 9 c 10 c 11 c 12 c 13 c 14 c 15 residue code 0 1 2 1 0 1 d d d d d d d d d d c 0 c 1 c 2 c 3 c 2 c 3 c 4 c 5 c 6 c 7 c 8 c 9 residue code 0 1 2 0 1 1 d d d c c c c c c c c 8 9 10 11 12 13 14 15 d d d d d d d d d d d d d d d d d d c 0 c 1 c 2 c 1 c 2 c 3 c 4 c 5 c 6 c 7 c 8 residue code 0 1 2 1 0 0 d d d c c c c c c c c 7 8 9 10 11 12 13 14 d d d d d c c c c c c c c 8 9 10 11 12 13 14 15 10216a-016a figure 4C16. six bits/character
data communication modes functional description amd 4C25 d c 0 d d d d c 0 c 1 c 2 c 3 c 4 c 5 c 6 c 7 c 7 c 8 c 9 c 10 c 11 c 12 c 13 c 14 c 8 c 9 c 10 c 11 c 12 c 13 c 14 c 15 residue code 0 1 2 1 1 1 d d d d d c 0 c 1 c 2 c 3 c 4 c 5 c 6 c 6 c 7 c 8 c 9 c 10 c 11 c 12 c 13 c 8 c 9 c 10 c 11 c 12 c 13 c 14 c 15 residue code 0 1 2 1 0 0 d d d d d d c 0 c 1 c 2 c 3 c 4 c 5 c 5 c 6 c 7 c 8 c 9 c 10 c 11 c 12 c 8 c 9 c 10 c 11 c 12 c 13 c 14 c 15 residue code 0 1 2 0 1 0 d d d d d c 0 c 1 c 2 c 3 c 4 c 4 c 5 c 6 c 7 c 8 c 9 c 10 c 11 c 8 c 9 c 10 c 11 c 12 c 13 c 14 c 15 residue code 0 1 2 1 1 0 d d d d d d d d d d c 0 c 1 c 2 c 3 c 3 c 4 c 5 c 6 c 7 c 8 c 9 c 10 residue code 0 1 2 0 0 1 d d d c c c c c c c c 8 9 10 11 12 13 14 15 d d d d d d d d d d d d d d d d d d c 0 c 1 c 2 c 2 c 3 c 4 c 5 c 6 c 7 c 8 c 9 residue code 0 1 2 1 0 1 d d d c c c c c c c c 8 9 10 11 12 13 14 15 d d d d d d d d d d d d c 0 c 1 c 1 c 2 c 3 c 4 c 5 c 6 c 7 c 8 residue code 0 1 2 0 1 1 d d d c c c c c c c c 8 9 10 11 12 13 14 15 d d d d d d 10216a-017a figure 4C17. seven bits/character
data communication modes functional description amd 4C26 10216a-018a d c 0 d d d d c 1 c 2 c 3 c 4 c 5 c 6 c 7 c 8 c 9 c 10 c 11 c 12 c 13 c 14 c 15 residue code 0 1 2 0 1 1 d d d d d c 0 c 1 c 2 c 3 c 4 c 5 c 6 c 7 c 8 c 9 c 10 c 11 c 12 c 13 c 14 c 8 c 9 c 10 c 11 c 12 c 13 c 14 c 15 residue code 0 1 2 1 1 1 d d d d d d c 0 c 1 c 2 c 3 c 4 c 5 c 6 c 7 c 8 c 9 c 10 c 11 c 12 c 13 c 8 c 9 c 10 c 11 c 12 c 13 c 14 c 15 residue code 0 1 2 0 0 0 d d d d d c 0 c 1 c 2 c 3 c 4 c 5 c 6 c 7 c 8 c 9 c 10 c 11 c 12 c 8 c 9 c 10 c 11 c 12 c 13 c 14 c 15 residue code 0 1 2 1 0 0 d d d d d d d d d d c 0 c 1 c 2 c 3 c 4 c 5 c 6 c 7 c 8 c 9 c 10 c 11 residue code 0 1 2 0 1 0 d d d c c c c c c c c 8 9 10 11 12 13 14 15 d d d d d d d d d d d d d d d d d d c 0 c 1 c 2 c 3 c 4 c 5 c 6 c 7 c 8 c 9 c 10 residue code 0 1 2 1 1 0 d d d c c c c c c c c 8 9 10 11 12 13 14 15 d d d d d d d d d d d d c 0 c 1 c 2 c 3 c 4 c 5 c 6 c 7 c 8 c 9 residue code 0 1 2 0 0 1 d d d c c c c c c c c 8 9 10 11 12 13 14 15 d d d d d d d (no residue) (one residue bit) (two residue bits) (3 residue bits) (4 residue bits) (5 residue bits) (6 residue bits) d d d d d c 0 c 1 c 2 c 3 c 4 c 5 c 6 c 7 c 8 residue code 0 1 2 1 0 1 d d d c c c c c c c c 8 9 10 11 12 13 14 15 d d d d d d (7 residue bits) d figure 4C18. eight bits/character 4.7.3 end of frame (eof) once character assembly begins characters are assembled according to the number of bits per character specified until an end of frame flag is detected. when this condition is detected, the receiver transfers the contents of the receive shift register into the re- ceive data fifo regardless of the number of bits assembled, and the residue code, the crc error bit, and eof status bit are latched in the receive error fifo. if either the rx interrupt on special condition only or rx interrupt on first character or special condition mode is selected, an interrupt will be generated when the eof status bit reaches the top of the error fifo, but only after its associated character is read from the receive data fifo. when the character is read the fifo will be locked, that is, the eof status bit remains set for all subsequent characters received until reset by the error reset command. the processor may then read rr1 to determine the crc status and residue code of the frame and issue an error reset command in wr0 to unlock the re- ceive data fifo.
data communication modes functional description amd 4C27 4.8 transmitter operation in sdlc modes, the transmitter automatically envelopes the data written to the transmit buffer register (wr8) with the flag character in wr7. because the scc transfers the flag character eight bits at a time, zero-suppressed flags (i.e., where the ending zero bit of one flag is the beginning zero bit of the succeeding flag) are not supported. the receiver, however, can receive either zero-suppressed or fully-formed flags. while flags are trans- mitted the zero insertion logic is inhibited. when transmitting data in sdlc modes, note that all data passes through the zero inser- ter, which adds an extra five bit times of delay between the transmit shift register and the transmit data (txd) pin. 4.8.1 transmitter initialization the initialization sequence for the transmitter in sdlc modes is: wr4 first, to select the mode, then wr10 to modify it if necessary, wr7 and wr6 to program the flag and ad- dress field (if used), and then wr3 and wr5 to select the various options. at this point, the other registers should be initialized as necessary. once all of this is complete the transmitter will be idle with the txd pin pulled high until the transmitter is enabled via bit d3 in wr5. when this bit is set to 1, the transmitter starts mark idling (i.e., a pattern of all one bits are sent eight bits at a time), and continues to mark idle until the mark/flag idle bit in wr10 (d3) is set to 0. when this bit is reset to 0 and the current mark idle pattern has left the transmit shift register, the transmitter will begin sending flag charac- ters and will continue to send flag characters until a character is written to the transmit buffer. during this flag idle time the crc generator may be initialized by issuing the re- set tx crc generator command in wr0. when a character is written to wr8 and the current flag character has been sent, the transmitter starts sending data and continues to send data until an underrun condition occurs. the tx buffer empty status bit in rr0 (d2) will be set to 1 each time the con- tents of wr8 are transferred to the transmit shift register. it will be reset to 0 each time the transmit buffer is written to, and while the crc is being sent in sdlc and synchro- nous modes. if the transmitter interrupt enable bit in wr1 is set to 1 then the low-to- high transition of the tx buffer empty status bit will generate an interrupt. 4.8.2 mark/flag idle generation the transmitter may be programmed to either mark or flag idle when no data are being transmitted. if the mark/flag idle bit in wr10 (d3) is set to 1, the transmitter will mark idle by transmitting continuous 1s; otherwise, it will flag idle by transmitting continuous flags. the state of this bit determines the idle pattern transmitted after the closing flag of the frame is sent and not before. on the nmos scc, if the transmitter is actively mark idling, and a frame of data is ready to be transmitted, the mark/flag idle bit must be set to 0 before data are written to wr8; otherwise, the opening flag will not be sent properly. however, care must be exer- cised in doing this because the mark idle pattern (eight 1 bits) is transmitted eight bits at a time, and all eight bits must have transferred from the transmit shift register before a flag may be loaded and sent. if data are written into the transmit buffer (wr8) before the flag is loaded into the transmit shift register, the data character written to wr8 will su- persede flag transmission and the opening flag will not be transmitted. 4.8.3 auto flag mode on the cmos scc, if bit d0 of wr15 is set to 1, and the scc is programmed for sdlc operation, an option is provided via bit d0 of wr7 that eliminates this requirement. if bit d0 of wr7 is set to 1 and a character is written to the transmit buffer while the trans- mitter is mark idling, the mark/flag idle bit in wr10 need not be reset to 0 in order to have the opening flag sent because the transmitter will automatically send it before com- mencing to send data. in addition, as long as bit d0 of wr15 and bit d1 of wr7 are set to 1, the crc transmit generator will be automatically preset to the initial state programmed by bit d7 of wr10
data communication modes functional description amd 4C28 (so the reset tx crc generator command is also not necessary), and the tx underrun/ eom latch will be reset automatically on every new frame sent. this ensures that an opening flag and proper crc generation and transmission will always be sent without processor intervention under varying bus latency conditions. 4.8.4 abort generation the premature termination of a frame is called an abort. a properly transmitted sdlc frame will be terminated by appending the crc characters and a closing flag, but the scc may be programmed to terminate the frame by sending an abort and a flag instead. this option allows the scc to abort the transmission of a frame in progress and at the same time signify to the receiver that another frame will follow. this is controlled by the abort/flag on underrun bit in wr10 (d2). when this bit is set to 1, and an underrun occurs, the transmitter will transmit an abort immediately fol- lowed by a flag instead of the normal crc. if this bit is set to 0, the frame will be termi- nated normally. the processor is also able to send an abort by issuing the send abort command via wr0. this command, when issued, will send eight consecutive 1s. after this pattern is transmitted, the transmitter will idle as programmed via bit d3 of wr10. since up to five consecutive 1s may have been sent prior to the command being issued, a send abort may cause a sequence of from eight to thirteen 1s to be transmitted. the send abort command also empties the transmit buffer register and sets the tx underrun/eom bit in rr0. 4.8.5 auto transmit crc generator preset the nmos scc does not automatically preset the crc generator prior to frame trans- mission. this must be done in software, usually during the initialization routine. this is accomplished by issuing the reset tx crc generator command via wr0. for proper results, this command must be issued while the transmitter is enabled and idling and be- fore any data are written to the transmit buffer. in addition, if crc is to be used, the transmit crc generator must be enabled by setting bit d0 of wr5 to 1. crc is normally calculated on all characters between opening and closing flags, so this bit should be set to 1 at initialization and never changed. note that a channel reset will not initialize the crc generator so a reset tx crc generator com- mand must be issued some time after a channel reset is executed. on the cmos scc, setting bit d0 of wr15 1 will cause the transmit crc generator to be preset automatically every time an opening flag is sent, so the reset tx crc genera- tor command is not necessary. 4.8.6 crc transmission the transmission of the crc check characters is controlled by the transmit crc enable bit in wr5 (d0) and the tx underrun/eom bit in rr0 (d6). however, if the transmit crc enable bit is set to 0 when a transmit underrun (i.e., both the transmit buffer and trans- mit shift register go empty) occurs, the crc check characters will not be sent regardless of the state of the tx underrun/eom bit. if the transmit crc enable bit is set to 1 when an underrun occurs, then the state of the tx underrun/eom bit and the abort/flag on underrun bit in wr10 (d2) determine the action taken by the transmitter. the abort/flag on underrun bit may be set or reset by the processor, whereas, the tx underrun/eom bit is set by the transmitter and can be reset only by the processor via the reset tx underrun/eom command in wr0. if the tx underrun/eom bit is set to 1 when an underrun occurs, the transmitter will close the frame by sending a flag; however, if this bit is set to 0, the frame data will be appended with either the accumulated crc characters followed by a flag or an abort pat- tern followed by a flag, depending on the state of the abort/flag on underrun bit in the wr10 (d2). in either case, after the closing flag is sent, the transmitter will idle the trans- mission line as specified by the mark/flag idle bit d3 in wr10.
data communication modes functional description amd 4C29 the tx underrun/eom status bit in rr0 will be set to 1 by the scc to indicate that an underrun has occurred, and that either the crc, or abort character, has been loaded into the transmit shift register for transmission. the low-to-high transition of this bit may be programmed to generate an external/status interrupt or, if interrupts are disabled, may be polled in rr0. hence, if the crc check characters are to be properly appended to a frame, the abort/ flag on underrun bit must be set to 0, and the reset tx underrun/eom command must be issued after the first but before the last character is written to the transmit buffer. this will ensure that either an abort or the crc will be transmitted if an underrun occurs. nor- mally, the abort/flag on underrun bit in wr10 should be set to 1 around the same time that the tx underrun/eom bit is reset so that an abort will be sent if the transmitter acci- dentally underruns, and then set to 0 near the end of the frame to allow the correct trans- mission of crc. note that the reset tx underrun/eom command will not reset the status bit latch if the transmitter is disabled. however, if no external/status interrupts are pending, or if a reset external/status interrupt command accompanies this command while the transmitter is disabled, an external/status interrupt will be generated with the tx underrun/eom bit reset in rr0. 4.8.7 auto tx underrun/eom latch reset on the cmos scc, if bit d0 of wr15 is set to 1, the option of having the tx underrun/ eom bit be reset automatically at the start of every frame is provided via bit d1 of wr7. this helps alleviate the software burden of having to respond within one character time when high speed data are being sent. 4.8.8 transmitter disabling the transmitter is enabled/disabled via bit d3 of wr5. data transmission from the scc does not begin until this bit is set to 1. disabling the transmitter can be done at any time, but if disabled during transmission of a character, that character will be completely sent. this applies to both data and flags. however, if the transmitter is disabled during the transmission of crc, the 16-bit transmission will not be completed and the remaining bits will be from wr7 (flag character). in the paragraph above, the term completely sent means shifted out the transmit shift register, not shifted out the zero-bit inserter which adds an additional 5-bit delay. on the nmos scc, if nrzi encoding is being used and the transmitter is disabled the state of the txd pin will depend on the last bit sent. that is, the txd pin may either idle in a low or high state as shown below in figure 4C19. although, in full-duplex applications this may not be a problem, in half-duplex applications the txd pin must be pulled high in order to allow proper reception of data. 4.8.9 nrzi mode transmitter disabling on the cmos scc, an option is provided that allows setting the txd pin high when oper- ating in sdlc mode with nrzi encoding enabled. if bit d0 of wr15 is set to 1, then bit d3 of wr7 can be used to set the txd pin high. note that the operation of this bit is in- dependent of the tx enable bit in wr5. the tx enable bit in wr5 is used to disable and enable the transmitter, whereas bit d3 of wr7 acts as a pseudo transmitter disable and enable by just forcing the txd pin high when set even though the transmitter may actu- ally be mark or flag idling. care must be used when setting this bit because any character being transmitted at the time this bit is set will be chopped off, and data written to the transmit buffer while this bit is set will be lost. when the transmit underrun occurs and the crc and closing flag have been sent, bit d3 can be set to pull txd high. when ready to start sending data again this bit must be reset to 0 before the first character is written to the transmit buffer. note that resetting this bit causes the txd pin to take whatever state the nrzi encoder is in at the time so synchro-
data communication modes functional description amd 4C30 nization at the receiver may take longer because the first transition seen on the txd pin may not coincide with a bit boundary. note that in order for this to function properly, bits d3 and d2 of wr10 must be set to 1 and 0 respectively. 4.9 sdlc loop mode the scc supports sdlc loop mode in addition to normal sdlc. sdlc loop mode is very similar to normal sdlc. it is usually used in applications where a point-to-point net- work is not appropriate (for example, point-of-sale terminals). in an sdlc loop there is a primary station, called the controller, that manages the mes- sage traffic flow on the loop. sdlc loop is a special type of configuration in which one or more stations are connected in a serial fashion; each station is a repeater of the up-loop data to the next down-loop station. sdlc loop operation requires the transmission link operate in a half-duplex, one direction only, mode. data transmitted on the loop by the primary station are relayed from station to station. 4.9.1 going on loop there are certain restrictions as to when and how a secondary station physically be- comes part of the loop. a secondary station that has just powered up must monitor the loop, without the one-bit-time delay, until it recognizes an eop. while waiting for an eop, the scc ties txd to rxd with only the internal gate delays in the signal path. when the first eop is recognized by the scc, the break/abort status bit is set in rr0, generat- ing an external/status interrupt (if so enabled). at the same time, the on-loop bit in rr10 (d4) is set to indicate that the scc is indeed on-loop, and a one-bit time delay is inserted in the txd to the rxd patch. this does not disturb the loop because the line is marking idle between the time that the controller sends the eop and the time that it re- ceives the eop back. the secondary station that has gone on-loop cannot transmit a message until a flag and the next eop are received. the requirement that a flag be re- ceived ensures that the scc cannot erroneously send messages until the controller ends the current polling sequence and starts another one. a secondary station goes off\loop in a similar manner. 1 1 0 0 1 1 1 1 1 1 0 0 transmitter disabled here txd pin output (nrzi encoded) high low 10216a-019a figure 4C19. transmitter disabling with nrzi encoding a secondary station in an sdlc loop is always listening to the messages being sent around the loop and must pass these messages to the rest of the loop by re-transmitting them with a one-bit-time delay. when given a command to go off-loop, the secondary sta- tion waits until the next eop to remove the one-bit-time delay.
data communication modes functional description amd 4C31 4.9.1.1 on-loop program sequence sdlc loop mode is similar to sdlc mode except that two additional control bits are used. they are the loop mode bit (d1) and the go active on poll bit (d4) in wr10. in addition to these two extra control bits, there are also two status bits in rr10. they are the on loop bit (d1) and the loop sending bit (d4). before loop mode is selected, both the receiver and transmitter must be completely initialized for sdlc operation. once this is done, loop mode is selected by setting bit d1 of wr10 to 1. at this point the scc connects txd to rxd with only gate delays in the path. at the same time a flag is loaded into the transmit shift register and is shifted to the end of the zero-bit inserter, ready for transmission. the scc will remain in this state until the go active on poll bit (d4) in wr10 is set to 1. when this bit is set to 1, the receiver begins looking for a sequence of seven consecutive 1s, indicating either an eop or an idle line. when the receiver de- tects this condition, the break/abort status bit in rr0 is set to 1 and a one-bit time delay is inserted in the path from rxd to txd. the on loop bit in rr10 is also set to 1 at this time, and the receiver enters hunt mode. the scc cannot transmit on the loop until a flag is received, causing the receiver to leave hunt mode, and another eop (bit pattern 11111110) is received. the scc is now on the loop and capable of transmitting on the loop. as soon as this status is recognized by the processor, the go active on poll bit in wr10 should be set to 1 to prevent the scc from transmitting on the loop without the consent of the processor. 4.9.1.2 on-loop message transmission when a secondary station has a message to transmit and it recognizes an eop on the line, the first thing that it does is to change the last 1 of the eop pattern to a 0 before transmitting it. this turns the eop into a flag sequence. the secondary station now places its message on the loop and terminates its message with an eop. any secondary stations further down the loop with messages to transmit can then append its message to the message of the first secondary station by the same process. all secondary stations without messages to send merely echo the incoming messages and are prohibited from placing messages on the loop, except upon recognizing an eop. 4.9.1.3 on-loop transmit message programming sequence to transmit a message on the loop, the go active on poll bit wr10 must be set to 1. once this is done, the scc will change the next received eop into a flag and begin transmitting on the loop. at this point the processor may either write the first character to the transmit buffer and wait for a transmit buffer empty condition or wait for the break/ abort and hunt status bits to be set to 1 in rr0 and the loop sending bit to be set to 1 in rr10 before writing the first data to the transmitter. note that the break/abort and hunt bits in rr0 will be set to 1 when the eop is received. if the data is written immediately after the go active on poll bit has been set, the scc will insert only one flag after the eop is changed into a flag. if the data is not written until after the receiver enters the hunt mode, flags will be transmitted until the data is written. if only one frame is to be transmitted on the loop in response to an eop, the processor must set the go active on poll bit to 0 before the last data is written to the transmitter. in this case the transmitter will close the frame with a single flag and then revert to the one-bit delay. the loop send- ing bit in rr10 is set to 0 when the closing flag has been sent. if more than one frame is to be transmitted, the go active on poll bit should not be set to 0 until the last frame is being sent. if this bit is not set to 0 before the end of a frame, the transmitter will send flags until either more data is written to the transmitter, or until the go active on poll bit is set to 0. note that the state of the abort/flag on underrun and mark/flag idle bits in wr10 are ignored by the scc in sdlc loop mode. 4.9.2 going off loop if sdlc loop mode is de-selected, the scc is designed to exit from the loop gracefully. when sdlc loop mode is de-selected by writing to wr10, the scc waits until the next polling cycle to remove the on-bit time delay. if a polling cycle is in progress at the time the command is written, the scc finishes sending any message that it figure 4C19. transmitter disabling with nrzi encoding may be transmitting, ends with an eop, and disconnects txd from rxd. if no message was in progress, the scc immediately discon-
data communication modes functional description amd 4C32 nects txd from rxd. to ensure proper loop operation after the scc goes off the loop, and until the external relays take the scc completely out of the loop, the scc should be programmed for mark idle instead of flag idle. when the scc goes off the loop, the onC loop bit is reset. 4.9.2.1 off loop programming sequence to go off the loop in an orderly manner requires actions similar to those taken to go on the loop. first, the go active on poll bit must be set to 0 and any transmission in pro- gress completed, if the scc is currently sending on the loop. this will be indicated by the loop sending bit in rr10 being set to 0. once the scc is not sending on the loop, exit from the loop is accomplished by setting the loop mode bit in wr10 to 0, and at the same time writing the abort/flag on underrun and mark/flag idle bits with the desired values. the scc will revert to normal sdlc operation as soon as an eop is received, or immediately, if the receiver is already in hunt mode because of the receipt of an eop. note that the break/abort and hunt bits in rr0 will be set to 1 and the on loop bit in rr10 will be set to 0 when eop is detected. if sdlc loop mode is enabled by the go active on poll bit (d4) in wr10 and the station receives an eop, the receiver will enter hunt mode. when the receiver is in hunt mode it is not possible to take the station off the loop unless data has been transmitted; i.e., a flag has been detected. 4.9.3 sdlc loop initialization the initialization sequence for the scc in sdlc loop mode is similar to the sequence used in sdlc mode, except that it is somewhat longer. the processor should program wr4 first, to select sdlc mode, and the wr10 to select the crc preset value, and pro- gram the mark/flag idle bit. the loop mode and go active on poll bits in wr10 should not be set to 1 yet. the flag is written in wr7 and the various options are selected in wr3 and wr5. at this point the other registers should be initialized as necessary, then the loop mode bit (d1) in wr10 should be set to 1. when all of this is complete, the transmitter may be enabled by setting bit d3 of wr5 to 1. now that the transmitter is enabled, the crc generator may be initialized by issuing the reset tx crc generator command in wr0. the receiver is enabled by setting the go active on poll bit (d4) in wr10 to 1. 4.9.4 sdlc loop nrzi encoding enabled the scc allows the user the option of using nrzi in sdlc loop mode by programming wr10 appropriately. with nrzi encoding, the outputs of secondary stations in the loop may be inverted from their inputs because of messages that they have transmitted. re- moving the stations from the loop (removing the one-bit time delay) may cause problems further down the loop because of extraneous transitions on the line. the scc avoids this problem by making transparent adjustments at the end of each frame it sends in re- sponse to an eop. a response frame from the scc is terminated by a flag and an eop. normally, the flag and the eop share a zero, but if such sharing would cause the rxd and txd pins to be of opposite polarity after the eop, the scc adds another zero between the flag and the eop. this causes an extra line transition so that rxd and txd are identical after the eop is sent. this extra zero is completely transparent because it means only that the flag and the eop no longer share a zero. all that a proper loop exit needs, therefore, is the re- moval of the one-bit time delay. 4.10 synchronous mode operation 4.10.1 receiver operation receiver operation in synchronous modes begin in a hunt mode where the communica- tions line is monitored for a synchronizing pattern on a bit-by-bit basis. the receiver may be placed in hunt mode by having the processor issue the enter hunt mode command
data communication modes functional description amd 4C33 via bit d4 in wr3. the enter hunt mode bit in wr3 is a command so writing a 0 to it has no effect. in synchronous modes, once character synchronization has been established, hunt mode is terminated and must remain so until the end of message has been received. at this point, the enter hunt mode command can be re-issued for the next message. issuing this command prematurely can lead to false character synchronization. thus, the sync/ hunt status bit in rr0 will be set only when the enter hunt mode command is issued. the hunt status of the receiver is reported in the sync/hunt status bit in rr0 (d4). this status bit is one of the possible sources of external/status interrupts, with both tran- sitions causing an interrupt. this is true even if the sync/hunt bit is set as a result of the processor issuing the enter hunt mode command. while in hunt mode, the receiver path used in establishing character synchronization will depend on the mode selected. in either case, however, synchronization will be estab- lished at the beginning of each transmission either through a two character (bisync) or a single character (monosync) synchronizing pattern. when character synchronization is established hunt mode is terminated and the receiver stops scanning the communication line for the synchronizing pattern. at this point data passes to the receive shift register and characters are formed by assembling the proper number of consecutive bits following the synchronizing pattern before being transferred into the receive data fifo. 4.10.1.1 sync detect output in synchronous modes, except external sync mode, if bit d7 of wr11 is set to 0, the sync pin will be configured as an output and the scc will drive it low every time a sync character is detected in the data stream. note, however, that the sync pin is activated regardless of character boundaries so any external circuitry using it in synchronous modes should respond only to the sync pulse that occurs while the receiver is in hunt mode. the timing for the sync signal is shown in figure 4C20. 4.10.1.1.1 monosync mode the message format for monosync is shown in figure 4C21. in this mode, the incom- ing data are clocked into the receive sync register and compared with the contents of wr7 on a bit-by-bit basis until a sync character is found. when a sync character is found, character synchronization is established and data passes to the receive shift register. in this mode, wr6 is always used to open a message being transmitted, and as time fill when the transmitter has nothing to send. 4.10.1.1.2 bisync mode the bisync message format is shown in figure 4C22. in this mode, the synchronization procedure is similar to that of monosync except that two sync characters are used for character synchronization instead of one. in this mode, incoming data are shifted into the receive shift register while the next eight bits are assembled in the receive sync regis- ter. if these two characters match the programmed characters in wr6 and wr7, respec- tively, synchronization is established and the incoming data bypasses the receive sync register and enters the 3-bit delay directly. in this mode, the concatenation of wr6 with wr7 is always used during transmit and re- ceive operations.
data communication modes functional description amd 4C34 rtxc pclk sync figure 4C20. sync as an output sync data crc figure 4C21. monosync message format syn syn soh stx etx or etb bcc text header direction of serial data flow figure 4C22. bisync message format 4.10.1.2 sync character length in synchronous modes, the sync character length that is used during transmit and receive operations is programmable via bit d0 of wr10. if this bit is set to 0 in monosync mode an 8-bit sync character will be used during transmit and receive operations; however, if set to 1 the 6-bit sync character option will be selected, and only the least significant six bits of wr6 will be used during transmis- sion, and the six high-order bits in wr7 will be used during receive. in bisync mode, this bit selects between a 12- or 16-bit sync character length; however, because the receiver requires that sync characters be left-justified in the registers, while the transmitter requires them to be right-justified, only the receiver will work properly with a 12-bit sync character. so if bit d0 of wr10 is set to 1, the receiver will be configured to recognize a 12-bit sync character, but the transmitter will remain configured for a 16-bit sync character. the arrangement of the sync character in wr6 and wr7 is shown in fig- ure 4C23. 4.10.1.3 receiver initialization the initialization sequence for the receiver in synchronous modes is to write to wr4 first, to select the mode, then wr10 to modify it if necessary, wr6 and wr7 to program the sync characters and then wr3 and wr5 to select the various options. at this point the other registers should be initialized as necessary. when all of this is complete the re- ceiver is enabled by setting bit d0 of wr3 to 1. 4.10.1.4 sync character removal in synchronous modes, a sync character that is not part of the data is transmitted before data to establish character synchronization at the receiver. once data transmission be- gins all characters are sent continuously and in phase with each other. since this syn- chronizing information is only present at the beginning of a message it may happen that during message transmission the combination of data characters may not provide suffi-
data communication modes functional description amd 4C35 cient transitions to allow self-clocking devices to remain in sync. under these conditions the equipment in use today will send sync characters in order to maintain character phase. in this case the receiver may want to recognize these characters and delete them from the receive data. this function is available in the scc by setting the sync character load inhibit bit (d1) in wr3 to 1. while this bit is set to 1, the character about to be loaded into the receive data fifo will be compared with the contents of wr6. if all eight bits match the character, it is not loaded into the fifo. because the comparison is across eight bits, this function works correctly only when the number of bits per character is the same as the sync character length. thus it cannot be used with 12- or 16-bit sync char- acters. both leading sync characters and sync characters embedded in the data will be properly removed in the case of an 8-bit sync character, but only the leading sync characters may be properly removed in the case of a 6-bit sync character. care must be exercised in us- ing this feature because sync characters not transferred to the receive data fifo will automatically be excluded from crc calculation. this works properly only in the 8-bit case. d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 sync 7 sync 1 sync 7 sync 3 adr 7 adr 7 sync 6 sync 0 sync 6 sync 2 adr 6 adr 6 sync 5 sync 5 sync 5 sync 1 adr 5 adr 5 sync 4 sync 4 sync 4 sync 0 adr 4 adr 4 sync 3 sync 3 sync 3 1 adr 3 x sync 2 sync 2 sync 2 1 adr 2 x sync 1 sync 1 sync 1 1 adr 1 x sync 0 sync 0 sync 0 1 adr 0 x monosync, 8 bits monosync, 6 bits bisync, 16 bits bisync, 12 bits sdlc sdlc (address range) d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 sync 7 sync 5 sync 15 sync 11 0 sync 6 sync 4 sync 14 sync 10 1 sync 5 sync 3 sync 13 sync 9 1 sync 4 sync 2 sync 12 sync 8 1 sync 3 sync 1 sync 11 sync 7 1 sync 2 sync 0 sync 10 sync 6 1 sync 1 x sync 9 sync 5 1 sync 0 x sync 8 sync 4 0 monosync, 8 bits monosync, 6 bits bisync, 16 bits bisync, 12 bits sdlc figure 4C23. sync character programming
data communication modes functional description amd 4C36 4.10.1.5 crc polynomial selection either of two crc polynomials may be used in synchronous modes. the polynomial that will be used by both the transmitter and receiver is selected by bit d2 in wr5. if this bit is set to 1, the crc-16 polynomial (x 16 +x 15 +x 2 +1) will be used; if this bit is set to 0, the crc-ccitt polynomial (x 16 +x 12 +x 5 +1) will be used. 4.10.1.5.1 rx crc initialization the initial state of both transmit and receive crc generators is controlled by bit d7 of wr10. when this bit is set to 1, both transmit and receive crc generators will be preset to an initial value of all 1s; if this bit is set to 0, they will be preset to an initial value of all 0s. the scc presets the receive crc generator whenever the receiver is in hunt mode so a crc reset command is not strictly necessary. however, it may be preset by issuing the reset crc checker command in wr0. the reset crc checker command is necessary in synchronous modes if the enter hunt mode command in wr3 is not issued between received messages. note that any action that disables the receiver in synchronous modes (including external sync mode) initializes the crc circuitry. 4.10.1.5.2 rx crc enabling if crc is to be used on receive data the receive crc generator must be enabled by set- ting bit d0 of wr3 to 1. if sync characters are being stripped (i.e., wr3 bit d1 set to 1) from the data stream, enabling the crc may be done at any time before the first non- sync character is received. if the sync strip feature is not being used, the crc generator must not be enabled until after the first data character has been transferred to the re- ceive data fifo. as previously mentioned, 8-bit sync characters stripped from the data stream are automatically excluded from crc calculation. the receive crc generator may be enabled and disabled as many times for a given calculation. 4.10.1.5.3 rx crc character exclusion being able to exclude characters from crc calculation is possible in the scc because crc calculation may be enabled and disabled on the fly. to give the processor sufficient time to decide whether or not a particular character should be included in the crc calcu- lation, the scc contains an 8-bit time delay between the receive shift register and the receive crc generator. the logic also guarantees that the calculation will start or stop only on a character boundary by delaying the enable or disable until the next character is loaded into the receive data fifo. to understand how this works refer to the following explanation and figure 4C24. consider a case where the scc receives a sequence of eight bytes, called a, b, c, d, e, f, g and h with a received first. now suppose that a is the sync character, that crc is to be calculated on b, c, e, and f, and that f is the last byte of this message. before a is received the receiver is in hunt mode and the crc is disabled. when a is in the receive shift register it is compared with the contents of wr7. since a is the sync character, the bit patterns match and receiver leaves hunt mode, but character a is not transferred to the receive data fifo. the crc remains disabled even though somewhere during the next eight bit times the processor reads b and enables crc. at the end of the eight-bit- time, b is in the 8-bit delay and c is in the receive shift register. character c is loaded into the receive data fifo and at the same time the crc checker is enabled. during the next eight-bit-time, the processor reads c and leaves the crc enabled. at the end of these eight-bit-times the scc has calculated crc on b, character c is the 8-bit delay and d is in the receive shift register. d is then loaded into the receive data buffer and at some point during the next eight-bit-time the processor reads d and disables crc. at the end of these eight-bit-times crc has been calculated on c, character d is in the 8-bit delay and e is in the receive shift register. now e is loaded into the receive data fifo and, at the same time, the crc is disabled. during the next eight-bit-times the processor reads e and enables the crc. during this time e shifts into the 8-bit delay, f enters the receive shift register and crc is not being calculated on d. after these eight-bit-times have elapsed, e is in the 8-bit delay, and f is
data communication modes functional description amd 4C37 in the receive shift register. now f is transferred to the receive data fifo and crc is enabled. during the next eight-bit-times the processor reads f and leaves the crc en- abled. the processor is usually aware that this is the last character in the message and so prepares to check the result of the crc computation. however, another sixteen bit- times are required before crc has been calculated on all of character f. at the end of eight-bit-times f is in the 8-bit delay and g is in the receive shift register. at this time g is transferred to the figure 4C23. sync character programming figure 4C24. receive crc data path for synchronous modes receive data fifo. character g must be read and discarded by the processor. eight bit times later h is transferred to the receive data fifo also. the result of a crc calculation is latched in the receive error fifo at the same time as data is written to the receive data fifo. thus the crc result through char- acter f accompanies character h in the fifo and will be valid in rr1 until character h is read from the receive data fifo. the crc checker may be disabled and reset at any time after character h is transferred to the receive data fifo. recall, however, that inter- nally crc will not be disabled until a character is loaded into the receive data fifo so the reset command should not be issued until after this occurs. a better alternative is to place the receiver in hunt mode, which automatically disables and resets the crc checker. 4.10.1.5.4 crc error because there is an eight bit delay between the receive shift register and receive crc generator in synchronous modes, the crc error status bit in rr1 will not be valid until 16 bit times after the last crc character has been loaded from the receive shift register to the receive data fifo. 4.10.2 transmitter operation in synchronous modes, the sync character in wr6 or the sync characters in wr6 and wr7 are used to open a message transmission. depending on the mode the transmitter is in either one or two sync characters will be loaded into the transmit shift register at the beginning of a message. all data are shifted simultaneously out the transmit multi- plexer and into the transmit crc generator. the result of the transmit crc generator is sent out the transmit multiplex when enabled. 4.10.2.1 transmitter initialization the initialization sequence for the transmitter in synchronous modes is: wr4 first, to select the mode, then wr10 to modify it if necessary, wr6 and wr7 to program the sync characters, and then wr3 and wr5 to select the various options. at this point, the other registers should be initialized as necessary. once all of this is complete the transmitter mark idles (i.e., txd pin high) until the transmitter is enabled via bit d5 in wr5. when the transmitter is enabled, it starts sending sync characters and continues to send sync characters until a character is written to the transmit buffer (wr8). during this sync idle time the crc generator may be initialized by issuing the reset tx crc generator command in wr0. when a character is written into wr8 and the current sync character has been sent, the transmitter starts transmitting data. it will then set the transmit buffer empty bit each time the contents of wr8 are transferred into the transmit shift register to indicate that another character can be loaded into wr8. 4.10.2.2 crc polynomial selection either of two crc polynomials may be used for error detection purposes. the selection for both the transmitter and receive is done via bit d2 of wr5. setting this bit to 1 se- lects the crc-16 polynomial, while setting it to 0 selects the crc-ccitt polynomial.
data communication modes functional description amd 4C38 receive data fifo receive shift register eight bit time delay crc checker receive data figure 4C24. receive crc data path for synchronous mode 4.10.2.2.1 tx crc initialization the initial state of the transmit and receive crc generators is controlled by bit d7 of wr10. when this bit is set to 1, both generators will be preset to an initial value of all 1s, if this bit is set to 0, both generators will be reset to 0s. the scc does not auto- matically preset the transmit crc generator, so this must be done in software. this is accomplished by issuing the reset tx crc generator command, which is encoded in bits d7 and d6 of wr0. for proper results this command must be issued while the trans- mitter is enabled and sending sync characters. 4.10.2.2.2 tx crc enabling if crc is to be used, the transmit crc generator must be enabled by setting bit d0 of wr5 to 1. this bit may also be used to exclude certain characters from the crc calcula- tion in synchronous modes. 4.10.2.2.3 crc transmission as in sdlc mode, the transmission of the crc check characters in synchronous modes is controlled by the transmit crc enable bit in wr5 (d0) and tx underrun/eom bit in rr0 (d6). if the transmit enable bit is set to 0 when a transmit underrun occurs, the crc check characters will not be sent regardless of the state of the tx underrun/eom bit. if the transmit enable bit is set to 1 when a transmit underrun occurs then the state of the tx underrun/eom bit determines the action taken by the transmitter. the tx un- derrun/eom bit is set by the transmitter and only reset by the processor via the reset tx underrun/eom command in wr0. if the tx underrun/eom bit is set to 1 when an underrun occurs, the transmitter will close the message just sent by sending sync characters; however, if this bit is set to 0, the transmitter will close the message by sending the accumulated crc followed by sync characters. the transmitter will idle the transmission line by sending sync characters until either more data are written to the transmit buffer or the transmitter is disabled.
data communication modes functional description amd 4C39 the tx underrun/eom status bit in rr0 will be set to 1 to indicate that an underrun has occurred, and that the crc, or sync characters, have been loaded into the transmit shift register for transmission. the low-to-high transition of this bit may be programmed to generate an external/status interrupt or, if interrupts are disabled, may be polled in rr0. hence, if the crc check characters are to be properly appended to the end of a mes- sage, the reset tx underrun/eom command must be issued after the first, but before the last, character is written to the transmit buffer. note that the reset tx underrun/eom command will not reset the status bit latch if the transmitter is disabled. however, if no external/status interrupts are pending, or if a re- set external/status interrupt command accompanies this command while the transmitter is disabled, an external/status interrupt will be generated with the tx underrun/eom bit reset in rr0. 4.10.2.2.4 tx crc character exclusion on the scc, leading sync characters are automatically excluded from crc calculation, but it will be calculated on any sync characters sent as data unless the transmit crc gen- erator is disabled via bit d0 of wr5 when that character is loaded in the transmit shift register from the transmit buffer. internally, the crc is enabled or disabled for a particular character at the same time as the character is loaded from the transmit buffer to the transmit shift register. thus, to exclude a character from crc calculation, bit d0 of wr5 should be set to 0 before the character is written to the transmit buffer. this guarantees that the internal disable will occur when the character moves from the buffer to the shift register. once the buffer be- comes empty, the tx crc enable bit may be set for the next character. 4.10.2.3 transparent transmission the scc can be used in applications where data are sent without enveloping them in any specific protocol or parity. this can be done by programming wr4 for the channel in ex- ternal sync mode as shown below. in this mode of operation, the transmitter will be configured for monosync operation and the sync pin will be used to signal when to start reception of data. the transmitter is initialized as before except that the first character to be sent must be written to wr6 be- fore enabling the transmitter. once the transmitter is enabled and transmission of the character in wr6 has started, the transmit buffer can be written to with the next charac- ter. from that point on, data from the transmit buffer will continue to be sent until the transmitter is disabled. to prevent any unwanted data in wr6 from being sent when a transmitter underrun occurs, the transmitter must be disabled during the transmission of the last character. the same procedure is followed if another data block is to be sent. 001100x0 wr4register layout data reception in this mode of operation requires that the sync pin be used to signal when character accumulation should commence at the receiver. as long as sync re- mains low data will continue to be received and transferred. 4.10.2.4 transmitter to receiver synchronization the scc contains a transmitter-to-receiver synchronization function that may be used to guarantee that the character boundaries for the received and transmitted data are the same. in this mode the receiver is in hunt and the transmitter is idle, sending either all 1s or all 0s. when the receiver recognizes a sync character, it leaves hunt mode and one character time later the transmitter is enabled and begins sending sync characters.
data communication modes functional description amd 4C40 beyond this point the receiver and transmitter are again completely independent, except that the character boundaries are now aligned. this is shown in figure 4C25. there are several restrictions on the use of this feature. first, it will work only with 6-bit, 8-bit or 16-bit sync characters, and the data character length for both the receiver and the transmitter must be six bits with a 6-bit sync character or eight bits with an 8-bit or 16-bit sync character. of course, the receive and transmit clocks must have the same rate as well as the proper phase relationship. a specific sequence of operations must be followed to synchronize the transmitter to the receiver. both the receiver and transmitter must have been initialized for operation in syn- chronous mode sometime in the past, although this initialization need not be redone each time the transmitter is synchronized to receiver. the transmitter is disabled by setting bit d3 of wr5 to 0. at this point the transmitter will send continous 1s. if it is desired that continous 0s be transmitted, the send break bit (d4) in wr5 should be set to 1. the transmitter is now idling but must still be placed in the transmitter to receiver synchroni- zation mode. this is accomplished by setting the loop mode bit (d1) in wr10 and then enabling the transmitter by setting bit d3 of wr5 to 1. at this point the processor should set the go active on poll bit (d4) in wr10. the final step is to force the receiver to search for sync characters. if the receiver is currently disabled the receiver will enter hunt mode when it is enabled by setting bit d0 of wr3 to 1. if the receiver is already enabled it may be placed in hunt mode by setting bit d4 of wr3 to 1. once the receiver leaves hunt mode the transmitter is activated on the following character boundary. 4.10.2.4.1 transmitter disabling in synchronous modes, if the transmitter is disabled during transmission of a character, that character will be completely sent before mark idling the line. this applies to both data and sync characters. however, if the transmitter is disabled during the transmission of crc, crc transmission will be terminated and the remaining bits will be from wr6 and/ or wr7 (sync registers) before mark idling the line. 4.10.2.5 external sync mode for those applications that may want to use external logic for receiver sychronization, the scc makes provisions for an external circuit to signal character synchronization on the sync pin. this mode expects the sync pin to be available for use; this means that bit d7 of wr11 should be set to 0. the external sync message format is shown in figure 4C26. in this mode, the sync/hunt status bit in rr0 reports the state of the sync pin but the receiver must be placed in hunt mode when the external logic is searching for a sync character match. when the receiver is in hunt mode and the sync pin is driven low, two receive clocks after the last bit of the sync character is received, character assembly will begin on the rising edge of the receive clock immediately following the activation of sync. this is shown in figure 4C27. both transitions on the sync pin will cause an ex- ternal/status interrupt if the sync/hunt ie bit is set to 1. sync sync sync sync rxd txd direction of message flow receiver leaves hunt figure 4C25. transmitter to receiver synchronization
data communication modes functional description amd 4C41 data data crc 1 crc 2 external sync signal figure 4C26. external sync message format the sync input falling edge (synchronized through some internal circuitry) essentially removes the receiver from hunt mode in which it is waiting for synchronization before accepting receive data. upon exiting hunt mode, the receiver will begin accepting all incoming receive data. to cause the am85c30 to discontinue accepting data (i.e. notify the am85c30 that there is an end of frame), the enter hunt mode command must be issued. the sync line should remain low for at least the twsy (sync* pulse width) specification value, and may be kept low for a longer duration of time if desired. 4.10.2.5.1 sdlc external sync mode by programming wr4 as shown below both the receiver and transmitter will be placed in sdlc mode. the only variation from normal sdlc operation will be that the sync pin will be used to start or stop the reception of a frame by forcing the receiver to act as though a flag had been received. 111100?? d7 d6 d5 d4 d3 d2 d1 d0 wr4register layout 4.10.2.5.2 synchronous external sync mode by programming wr4 as shown below the transmitter will be configured for monosync operation and the sync pin will be used to start the reception of a message. d7 ? d6 ? d5 1 d4 1 d3 0 d2 0 d1 ? d0 ? 0 0 programming either of these bit patterns specifies that only the sync pin can be used for character sync either the sync pin or a match with the character stored in wr7 will signal character sync 1 0 1 0 wr4register layout
data communication modes functional description amd 4C42 rtxc rxd sync sync lastC1 sync last data 0 data 1 data 2 figure 4C27. external sync receiver synchronization
5C1 chapter 5 support circuitry programming 5.1 introduction 5C3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.2 clock options 5C3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.2.1 crystal oscillator 5C3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.2.2 receive clock source 5C4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.2.3 transmit clock source 5C4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.2.4 clock programming 5C5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.3 baud rate generator (brg) 5C6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.3.1 brg clock source 5C8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.3.2 brg enabling/disabling 5C8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.3.3 brg initialization 5C9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.4 data encoding/decoding 5C9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.4.1 nrz (non-return to zero) 5C9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.4.2 nrzi (non-return to zero inverted) 5C9 . . . . . . . . . . . . . . . . . . . . . . . . . . 5.4.3 fm1 (biphase mark) 5C10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.4.4 fm0 (biphase space) 5C10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.4.5 manchester decoding 5C10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.4.6 data encoding programming 5C10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.5 digital phase-locked loop (dpll) 5C10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.5.1 dpll clock source 5C11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.5.2 dpll enabling 5C11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.5.3 dpll modes 5C11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.5.3.1 nrzi mode 5C11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.5.3.2 fm mode 5C12 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.5.3.3 manchester decoding mode 5C13 . . . . . . . . . . . . . . . . . . . . . . . . . 5.5.3.4 fm mode dpll receive status 5C13 . . . . . . . . . . . . . . . . . . . . . . 5.5.4 dpll initialization 5C15 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.5.5 am85c30-16 dpll operation at 32 mhz 5C15 . . . . . . . . . . . . . . . . . . . . . . 5.5.5.1 introduction 5C15 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.5.5.2 benefit 5C15 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.5.5.3 applications 5C15 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.5.5.4 description 5C15 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.5.5.5 competition 5C15 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.6 diagnostic modes 5C15 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.6.1 local loopback 5C16 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.6.2 auto echo 5C16 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
support circuitry programming amd 5C2
5C3 support circuitry programming chapter 5 5.1 introduction the scc incorporates additional logic on-chip which dramatically reduces the need for external hardware. this includes clocking options, baud rate generators, clock recovery logic, on-chip oscillators, and internal loopback modes. this chapter discusses how to program these functions. 5.2 clock options the scc may be programmed to select one of several sources to provide the transmit and receive clocks. in addition, the scc contains a crystal oscillator in each channel, as well as the ability to echo one of several internal clock sources off chip. these options are controlled by the bits in wr11 as shown below. wr11 is the clock mode control register for both the receive and transmit clocks. it de- termines the type of signal on the sync and rtxc pins and the direction of the trxc pin. this register also controls the output of the baud rate generator, the dpll output, and the selection of either an input clock or xtal output for the rtxc pin. 5.2.1 crystal oscillator the crystal oscillator option is controlled by bit d7 in wr11. when this bit is set to 0, the crystal oscillator is disabled and all pins function normally. when this bit is set to 1, the crystal oscillator is enabled and a high-gain amplifier is connected between the rtxc pin and the sync pin. while the crystal oscillator is enabled, anything that has rtxc se- lected as its clock source will automatically be connected to the output of the crystal oscil- lator. while the crystal oscillator is enabled, the sync pin is unavailable for other use. in syn- chronous modes no sync pulse is output, and the external sync mode cannot be se- lected. in asynchronous mode, the state of the sync/hunt bit in rr0 is no longer con- trolled by the sync pin. instead, the sync/hunt bit is forced to 0. note that the crystal oscillator requires some finite time to stabilize (20 ms) and so must be allowed to stabilize before being used as a clock. for best results, a crystal oscillator with the following specifications should be used; n 30 ppm @ 25 c n <50 ppm over temperature range of C20 to 70 c n <5 ppm/yr aging n 5 mw drive level
support circuitry programming amd 5C4 d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 00 01 10 11 00 01 10 11 00 01 10 11 trxc out = xtal output trxc out = transmit clock trxc out = br generator output trxc out = dpll output trxc o/i transmit clock = rtxc pin transmit clock = trxc pin transmit clock = br generator output transmit clock = dpll output receive clock = rtxc pin receive clock = trxc pin receive clock = br generator output receive clock = dpll output rtxc x tal/ no x tal wr11clock mode control 5.2.2 receive clock source the source of the receive clock is controlled by bits d6 and d5 of wr11. the receive clock may be programmed to come from the rtxc pin, the trxc pin, the output of the baud rate generator, or the transmit output of the dpll. 5.2.3 transmit clock source the source of the transmit clock is controlled by bits d4 and d3 of wr11. the transmit clock may be programmed to come from the rtxc pin, the trxc pin, the output of the baud rate generator, or the transmit output of the dpll. ordinarily the trxc pin is an input, but it becomes an output if this pin is not selected as the source for the transmitter or the receiver, and bit d2 of wr11 is set to 1. the selec- tion of the signal provided on the trxc output pin is controlled by bits d1 and d0 of wr11. the trxc pin may be programmed to provide the output of the crystal oscillator, the output of the brg, the receive output of the dpll or the actual transmit clock. if the output of the crystal oscillator is selected but the crystal oscillator has not been enabled, the trxc pin will be driven high. the option of placing the transmit clock signal on the trxc pin, when it is an output, allows access to the transmit output of the dpll.
support circuitry programming amd 5C5 figure 5C1 shows a simplified schematic diagram of the circuitry used in the clock multi- plexing. it shows the inputs to the multiplexer section as well as the various signal inver- sions that occur in the paths to the outputs. also shown are the edges used by the re- ceiver, transmitter, brg, and dpll to sample or send data or otherwise change state. for example, the receiver samples data on the falling edge, but since there is an inver- sion in the clock path between the rtxc pin and the receiver, a rising edge of the rtxc pin samples the data for the receiver. 5.2.4 clock programming selection of the clock options may be done anywhere in the initialization sequence, but the final values must be selected before the receiver, transmitter, brg, or dpll are en- abled to prevent problems from arbitrarily narrow clock signals out of the multiplexers. the same is true of the crystal oscillator, in that the output should be allowed to stabilize before it is used as a clock source. sync osc osc rtxc dpll tx rx receiver transmitter trxc brg echo echo dpll baud rate baud rate generator out tx dpll out rx dpll out pclk generator figure 5C1. clock multiplexer
support circuitry programming amd 5C6 5.3 baud rate generator (brg) each channel in the scc contains a programmable brg. each generator consists of two 8-bit, time-constant registers forming a 16-bit time constant, a 16-bit down counter, and a flip-flop on the output that makes the output a square wave. on start-up, the flip-flop on the output is set high so that it starts in a known state, the value in the time-constant reg- ister is again loaded into the counter, and the counter begins counting down. upon reaching a count of zero, the output of the brg toggles and the time-constant value held in wr12 and wr13 is reloaded into the down counter and the process of counting down starts over. when the zero count is reached, the output of the brg toggles, and for the duration of the zero count, the zero count status signal goes active to the external/ status interrupt section. refer to zero count section for details on the zero count status bit in rr0. while the brg is disabled the state of the zero count status bit in rr0 will always read 0 providing the zero count ie bit in wr15 is reset. while the zero count ie bit is set, the zero count status bit in rr0 will be set to 1 for as long as the brg counter is at the count of zero. this status bit is forced active by a hardware reset. no attempt is made to synchronize the loading of a new time constant with the clock used to drive the brg. when the time-constant is to be changed, the generator should be stopped by resetting bit d0 of wr14. this ensures the loading of a correct time constant. the time-constant for the brg is programmed in wr12 and wr13, with the least signifi- cant byte in wr12. the formulas relating the baud rate to the time-constant and vice versa are shown in table 5C1 with an example. in these formulas the brg clock fre- quency is in hertz, the desired baud rate in bits/second and the time-constant is dimen- sionless. the example in table 5C2 assumes a 2.4576 mhz clock frequency and shows the time-constant for a number of popular baud rates. table 5C1. time constant formulas time constant = clock frequency C2 2 (clock mode) (baud rate) baud rate = clock frequency 2 (clock mode) (time constant + 2) table 5C2. baud rate example baud rate divider decimal hex 38400 0 0000h 19200 2 0002h 9600 6 0006h 4800 14 000eh 2400 30 001eh 1200 62 003eh 600 126 007eh 300 254 00feh 150 510 01feh for 2.4576 mhz, x16 clock mode
support circuitry programming amd 5C7 if neither the transmit clock nor the receive clock is programmed to come from the trxc pin, the output of the brg may be made available for external use on the trxc pin. figure 5C2 shows a block diagram of the brg. the brg input comes from the output of a two-input multiplexer, and the zero count condition is outputed to the external/status interrupt section. the brg may be disabled and enabled by command and is disabled by a hardware reset. zero count ? 2 baud rate generator clock rtxc pin pclk pin select output wr13 wr12 16 bit down counter figure 5C2. baud rate generator write to wr14 clock source counter clock counter first decremented (after hardware reset) counter first decremented (after previous disable) end of write to wr14 with enable figure 5C3. brg startup
support circuitry programming amd 5C8 5.3.1 brg clock source the clock source for the brg is selected by bit d1 of wr14. when this bit is set to 0, the brg uses the signal on the trxc pin as its clock, independent of whether the trxc pin is a simple input or part of the crystal oscillator circuit. when this bit is set to 1, the brg is clocked by pclk. note that in order to avoid metastable problems in the counter, this bit should be changed only while the brg is disabled, since arbitrarily narrow pulses can be generated at the output of the multiplexer when it changes status. 5.3.2 brg enabling/disabling the brg is enabled while bit d0 of wr14 is set to 1 and is disabled while this bit is set to 0. to prevent metastable problems when the brg is first enabled, the enable bit is synchronized to the brg clock. this introduces an additional two count delay when the brg is first enabled as shown in figure 5C3. the brg is disabled immediately when bit d0 of wr14 is set to 0 and no delay is gener- ated. the brg may be enabled and disabled on the fly, but this delay on startup must be taken into consideration. note that on the nmos z8530 (non-hstep), it has been verified that if the brg is dis- abled and then re-enabled, the brg down counter may become underflowed. when this happens there will be a delay of (ffff) (brg clk period) = 65535 (brg clk period) before the down counter is loaded with the new time constant. this will delay any activity which is controlled by the brg. it is important to clarify that if the underflow condition occurs, the resultant delay will occur once. all subsequent brg controlled delays will be per the programmed brg count value. in a system this one time delay may not cause a failure since activities like data transmission do not have to be completed within a fixed time frame. if the delay happens, the data remains in the transmit buffer and will be transmitted at a later time. however, in diagnostic routines the baud rate delay can cause failures, since all activities are ex- pected to be completed within a fixed time frame. therefore, in order to guarantee correct operation, the scc brg should be operated ac- cording to the following guidelines: 1) if the brg needs to be disabled, re-enable it only after a hardware reset. this is not al- ways possible or desirable, but will guarantee that no underflow condition will occur. 2) if the time constant has to be re-loaded, do it on the fly with the lsb first. n if msb is not being used (msb = 00h), then the maximum delay for the new baud rate will be: (old lsb) (brg clock cycle) n if both msb and lsb are being used, then loading the new lsb first might generate an intermediate baud rate determined by the new lsb and old msb time constants. after the new msb is loaded the worst case delay for the new baud rate will be: max[(old msb,old lsb),(old msb,new lsb)] (brg clock cycle) if during the transition from the old baud rate to the new one the baud rate is not being used, and the above delays are taken into consideration, then loading the time constant on the fly will not cause any problems and will guarantee that no underflow condition will occur. 3) if the brg has to be disabled and re-enabled without a hardware reset, then the baud rate may be delayed one time by 65535 * (brg clk period).
support circuitry programming amd 5C9 5.3.3 brg initialization initializing the brg is done in four steps. first, the time-constant is determined and loaded into wr12 and wr13. next, the processor must select the clock source for the brg by writing to bit d1 of wr14. finally, the brg is enabled by setting bit d0 of wr14 to 1. note that the first write to wr14 is not necessary after a hardware reset if the clock source is to be the rtxc pin. this is because a hardware reset automatically selects the rtxc pin as the brg clock source. 5.4 data encoding/decoding the scc provides four data encoding methods, selected by bits d6 and d5 in wr10. an example of these four methods is shown in figure 5C4. encoding may be used for asyn- chronous or synchronous data as long as the clock mode is x1. note that the data encod- ing method selected is active even though the transmitter or receiver may be idling or dis- abled. 11 001 0 data nrz nrzi fm1 (biphase mark) fm0 (biphase space) bit cell level: high = 1 low = 0 no change = 1 change = 0 bit center transition: transition = 1 no transition = 0 manchester no transition = 1 transition = 0 high ? low = 1 low ? high = 0 figure 5C4. data encoding 5.4.1 nrz (non-return to zero) in nrz encoding a 1 is represented by a high level and a 0 is represented by a low level. in this encoding method only a minimal amount of clocking information is available in the data stream in the form of transitions on bit-cell boundaries. in an arbitrary data pattern this may not be sufficient to generate a clock for the data from the data itself. 5.4.2 nrzi (non-return to zero inverted) in nrzi encoding a 1 is represented by no change in the level and a 0 is represented by a change in the level. as in nrz only a minimal amount of clocking information is available in the data stream, in the form of transitions on bit cell boundaries. in an arbi- trary data pattern this may not be sufficient to generate a clock for the data from the data itself. in the case of sdlc mode operation, where the number of consecutive 1s in the data stream is limited, a minimum number of transitions to generate a clock are guar- anteed.
support circuitry programming amd 5C10 5.4.3 fm1 (biphase mark) in fm1 encoding, also known as biphase mark, a transition is present on every bit cell boundary, and an additional transition may be present in the middle of the bit cell. in fm1, a 0 is sent as no transition in the center of the bit cell and a 1 is sent as a transition in the center of the bit cell. fm1 encoded data contains sufficient information to recover a clock from the data. 5.4.4 fm0 (biphase space) in fm0 encoding, also known as biphase space, a transition is present on every bit cell boundary and an additional transition may be present in the middle of the bit cell. in fm0 a 1 is sent as no transition in the center of the bit cell and a 0 is sent as a transition in the center of the bit cell. fm0 encoded data contains sufficient information to recover a clock from the data. 5.4.5 manchester decoding in addition to these four methods, the scc can be used to decode manchester (biphase level) data using the dpll in the fm mode and programming the receiver for nrz data. manchester encoding always produces a transition at the center of the bit cell. if the tran- sition is high-to-low, the bit is a 1; if the transition is low-to-high, the bit is a 0. 5.4.6 data encoding programming the data encoding method to be used should be selected in the initialization procedure before the transmitter and receiver are enabled but no other restrictions apply. note, in figure 5C4, that in nrz and nrzi the receiver samples the data only on one edge. how- ever, in fm1 and fm0, the receiver samples the data on both edges. also, as shown in figure 5C4, the transmitter defines bit cell boundaries by one edge in all cases and uses the other edge in fm1 and fm0 to create the mid-bit transition. 5.5 digital phase-locked loop (dpll) the scc contains a dpll that can be used to recover clock information from a data stream with nrzi or fm coding. the dpll is driven by a clock that is nominally 32 (nrzi) or 16 (fm) times the data rate. the dpll uses this clock, along with the data stream, to construct a receive clock for the data. this clock can then be used as the re- ceive clock, the transmit clock, or both. figure 5C5 shows a block diagram of the dpll. it consists of a 5-bit counter, an edge detector, and a pair of output decoders. the clock for the dpll comes from the output of a two-input multiplexer, and the two outputs go to the transmitter and receive clock multi- plexers. the dpll is controlled by seven commands that are encoded in bits d7, d6, and d5 of wr14. edge detector rxd receive clock decode count modifier 5-bit counter transmit clock decode figure 5C5. dpll
support circuitry programming amd 5C11 5.5.1 dpll clock source the clock for the dpll is selected by two of the commands in wr14. one command se- lects the output of the brg as the clock source, and the other command selects the rtxc pin as the clock source, independent of whether the rtxc pin is a simple input or part of the crystal oscillator circuit. note that in order to avoid metastable problems in the counter, the clock source selection should be made only while the dpll is disabled, since arbitrarily narrow pulses can be generated at the output of the multiplexer when it changes status. 5.5.2 dpll enabling the dpll is enabled by issuing the enter search mode command in wr14. this com- mand is also used to reset the dpll to a known state if it is suspected that synchroniza- tion has been lost. when used to enable the dpll, the enter search mode command unlocks the counter, which is held while the dpll is disabled, and enables the edge de- tector. if the dpll is already enabled when this command is issued, the dpll also enters search mode. while in search mode, the counter is held at a specific count and no outputs are pro- vided. the dpll remains in this status until an edge is detected in the receive data stream. this first edge is assumed to occur on a bit cell boundary, and the dpll will be- gin providing an output to the receiver that will properly sample the data. as long as no other edges are detected, the dpll output clock will free run at a frequency equal to the dpll clock source divided by 32 without any phase jitter. upon detecting another edge the dpll will adjust the output clock to remain in phase with the received data by adding or subtracting a count of one. this will result in a phase jitter of 5.63 on the dpll out- put. because the dpll uses both edges of the incoming data to compare with its clock source, a mark-space deviation of no greater than 1.5% (from 50%) should be main- tained at the interface. if the first edge that the dpll sees does not occur on a bit cell boundary, the dpll will eventually lock on to the receive data but it will take longer to do so. 5.5.3 dpll modes the dpll may be programmed to operate in either nrzi or fm modes, as selected by a command in wr14. note that as in the case of the dpll clock source selection, the mode of operation should only be changed while the dpll is disabled to prevent unpre- dictable results. 5.5.3.1 nrzi mode in nrzi mode, the clock supplied to the dpll must be 32 times the data rate. in this mode the transmit and receive clock outputs of the dpll are identical, and the clocks are phased so that the receiver samples the data in the middle of the bit cell. in nrzi mode, the dpll does not require a transition in every bit cell, so this is useful for recovering the clocking information from nrz and nrzi data streams. the dpll uses the x32 clock along with the receive data, to construct receive and trans- mit clock outputs that are phased to properly receive and transmit data. to do this, the dpll divides each bit cell into two regions, and makes an adjustment to the count cycle of the 5-bit counter dependent upon in which region a transition on the receive data input occurred. this is shown in figure 5C6. ordinarily, a bit cell boundary will occur between count 15 and count 16, and the dpll output will cause the data to be sampled in the middle of the bit cell. the dpll actually allows the transition marking a bit cell boundary to occur anywhere during the second half of count 15 or the first half of count 16 without making a correction to its count cycle.
support circuitry programming amd 5C12 bit cell 17 count 16 19 18 21 20 23 22 25 24 27 26 28 30 29 31 1 03 25 47 69 811 10 12 14 13 15 correction add one count subtract one count no change no change dpll out figure 5C6. dpll in nrzi mode however, if the transition marking a bit cell boundary occurs between the middle of count 16 and count 31 the dpll is sampling the data too early in the bit cell. in response to this the dpll extends its count by one during the next 0 to 31 counting cycle, which effec- tively moves the edge of the clock that samples the receive data closer to the center of the bit cell. in a similar manner, if the transition occurs between count 0 and the middle of count 15, the output of the dpll is sampling the data to late in the bit cell. to correct this, the dpll shortens its count by one during the next 0 to 31 counting cycle, which effec- tively moves the edge of the clock that samples the receive data closer to the center of the bit cell. in nrzi mode, if the dpll does not see any transition during a counting cycle, no adjust- ment is made in the following counting cycle. if an adjustment to the counting cycle is necessary the dpll modifies count five, either deleting it or doubling it. thus only the low time of the dpll output will be lengthened or shortened. while the dpll is in search mode, the counter remains at count 16, where the dpll outputs are both high. an exam- ple of the dpll in operation is shown in figure 5C7. 5.5.3.2 fm mode in fm mode, the clock supplied to the dpll must be 16 times the data rate. in this mode the transmit clock output of the dpll lags the receive clock output by 90 degrees. this is necessary to make the transmit and receive bit cell boundaries coincide, since the receive clock must sample the data one-fourth and three-fourths of the way through the bit cell. in fm mode the dpll requires a transition in every bit cell, and if this transition is not pre- sent in two consecutive sampled bit cells, the dpll automatically enters search mode. the dpll uses the clock supplied, along with the receive data, to construct receive and transmit clock outputs that are phased to receive and transmit data properly. in fm mode the counter in the dpll still counts from 0 to 31 but now each cycle corresponds to 2 bit cells. in order to make adjustments and remain in phase with the receive data, the dpll divides a pair of bit cells into five regions, making the adjustment to the counter depend- ent upon which region the transition on the receive data input occurred. this is shown in figure 5C8. ordinarily, a bit cell boundary will occur between count 15 or count 16, and the dpll re- ceive output will cause the data to be sampled at one-fourth and three-fourths of the way through the bit cell. the dpll actually allows the transition marking a bit cell boundary to occur anywhere during the second half of count 15 or the first half of count 16 without making a correction to its count cycle.
support circuitry programming amd 5C13 however, if the transition marking a bit cell boundary occurs between the middle of count 16 and the middle of count 19 the dpll is sampling the data too early in the bit cell. in response to this the dpll extends its count by one during the next 0 to 31 counting cycle, which effectively moves the receive clock edges closer to to where they should be. in fm mode any transitions occurring between the middle of count 19 in one cycle and the mid- dle of count 12 during the next cycle are ignored by the dpll. this is necessary to guar- antee that any data transitions in the bit cells will not cause an adjustment to the counting cycle. as in nrzi mode, if an adjustment to the counting cycle is necessary, the dpll modifies count 5, either deleting it or doubling it. if no adjustment is necessary, the count sequence proceeds normally. while the dpll is in search mode, the counter remains at count 16, where the receive output is low and the transmit output is low. this fact can be used to provide a transmit clock under software control since the dpll is in search mode while it is disabled. note that while the dpll is disabled the transmit clock output of the dpll may be toggled by alternately selecting fm and nrzi mode in the dpll. the same is true of the receive clock. +1 C1 +1 C1 +1 C1 +1 C1 +1 C1 +1 C1 +1 C1 +1 C1 +1 32 32 32 31 31 31 33 33 33 receive data dpll output correction windows count length figure 5C7. dpll in fm mode 5.5.3.3 manchester decoding mode in addition to fm and nrzi encoded data, the dpll may also be used to recover the clock from manchester encoded data, which contains a transition at the center of every bit cell. here it is the direction of the transition that distinguishes a 1 from a 0. another way of looking at manchester encoding is to realize that, during the first half of the bit cell the data are sent; during the second half of the bit cell the complement of the data are sent. this is shown in figure 5C9, along with the dpll output if it thinks that the mid-bit transitions are really bit cell boundaries. as is obvious from the figure, if the receiver sam- ples the data on the falling edge of the dpll receive clock output, the manchester data will be properly decoded. this occurs if the receiver is programmed to accept nrz data. 5.5.3.4 fm mode dpll receive status from the above discussion together with an examination of fm0 and fm1 data encoding, it should be obvious that only clock transitions should exist on the receive data pin when the dpll is programmed to enter search mode. if this is not the case the dpll may at- tempt to lock on to the data transitions. with fm0 encoding this requires continuous 1s received when leaving search mode. in fm1 encoding it is continuous 0s; with manchester encoded data this means alternating 1s and 0s.
support circuitry programming amd 5C14 with all three of these data encoding methods there will be at least one transition in every bit cell, and in fm mode the dpll is designed to expect this transition. in particular, if no transition occurs between the middle of count 12 and the middle of count 19, the dpll is probably not locked onto the data properly. when the dpll misses an edge the one clock missing bit in rr10 is set to 1 and latched. it will hold this value until a reset missing clock command is issued in wr14 or until the dpll is disabled or programmed to enter the search mode. upon missing this one edge the dpll takes no other action and does not modify its count during the next counting cycle. however, if the dpll does not see an edge between the middle of count 12 and the middle of count 19 in two successive 0 to 31 count cycles, a line figure 5C7. dpll operating example error condition is assumed. if this occurs, the two clocks missing bits in rr10 are set to 1 and latched. at the same time the dpll enters the search mode. the dpll makes the decision to enter search mode during count 2, where both the receive and transmit clock outputs are low. this prevents any glitches on the clock outputs when search mode is entered. while in search mode no clock outputs are provided by the dpll. the two clocks missing bit in rr10 is latched until a reset missing clock command is issued in wr14, or until the dpll is disabled or programmed to enter the search mode. in nrzi mode of operation and while the dpll is disabled, the one and two clock miss- ing bits in rr10 will be reset to 0. bit cell 17 count 16 19 18 21 20 23 22 25 24 27 26 28 30 29 31 1 03 25 47 69 811 10 12 14 13 15 correction ignored no change no change rx dpll out +1 C1 tx dpll out figure 5C8. dpll in fm mode 11 0 01 0 data manchester rx dpll out tx dpll out figure 5C9. manchester clock recovery
support circuitry programming amd 5C15 5.5.4 dpll initialization initialization of the dpll may be done at any time during the initialization sequence, but should probably be done after the clock modes have been selected in wr11, and before the receiver and transmitter are enabled. when initializing the dpll the clock source should be selected first, followed by the se- lection of the operating mode. at this point the dpll, may be enabled by issuing the en- ter search mode command in wr14. note that a channel or hardware reset disables the dpll, selects the rtxc pin as the clock source for the dpll, and places it in the nrzi mode. note that the dpll is not free running if it is in search mode. unless the dpll receives a continuous stream of data, it will lose synchronization and enter search mode. it is there- fore recommended that the clock input of the transmitter is fed from a continuous clock source other than the dpll unless it can be guaranteed the dpll always receives enough data to stay synchronized. 5.5.5 am85c30-16 dpll operation at 32 mhz 5.5.5.1 introduction the digital phase-locked loop (dpll) for the am85c30-16 can operate at twice the data sheet frequency (32 mhz). the dpll is used to recover clock information from a fm data stream. this enhancement is available for commercial product only . all am85c30-16 devices are tested to guarantee 32 mhz dpll capability. 5.5.5.2 benefit the customer can transmit and receive serial data at 2 mb/s in fm mode. this is twice the data rate specified in the data sheet. this is over three times what the competition can do. as specified in the competitions data sheet, 10 mhz part can only handle a 10 mhz clock for the dpll. the am85c30-16 dpll can run at 32 mhz for both synchro- nous (sdlc) and asynchronous modes with fm encoding. this eliminates the need for an external dpll and allows the user to utilize fm encoding at higher data rates. 5.5.5.3 applications the increased data rate of 2 mb/s is ideal for both factory and office automation applica- tions including local area networks as well as other rs485 and rs422 applications. 5.5.5.4 description an external 32 mhz, 50% duty cycle, ttl compatible signal to the rtxc pin provides the clock for the dpll. the pclk remains at 16 mhz. the rest of the setup is described in detail in the previous section of this technical manual. 5.5.5.5 competition the competitions data sheet for their 85c30 limits the clock for the dpll to less than 10 mhz. this translates to only 0.625 mb/s for fm transmission and reception. the am85c30-16 transmits and receives fm data at 2.0 mb/sover three times faster than the competitions part. 5.6 diagnostic modes the scc contains two other features useful for diagnostic purposes controlled by bits in wr14. these are local loopback and auto echo.
support circuitry programming amd 5C16 5.6.1 local loopback local loopback is selected when bit d4 of wr14 is set to 1. in this mode the output of the transmitter is internally connected to the input of the receiver. at the same time the txd pin remains connected to the transmitter. in this mode the dcd pin is ignored as a receiver enable and the cts pin is ignored as a transmitter enable even if the auto en- ables mode has been selected. note that the dpll input is connected to the rxd pin, not to the input of the receiver. this precludes the use of the dpll in local loopback. local loopback is shown schematically in figure 5C10. 5.6.2 auto echo auto echo is selected when bit d3 of wr14 is set to 1. in this mode the txd pin is con- nected directly to the rxd pin, and the receiver input is connected to the rxd pin. in this mode the cts pin is ignored as a transmitter enable and the output of the transmitter does not connect to anything. if both the local loopback and auto echo bits are set to 1, the auto echo mode will be selected, but both the cts pin and the dcd pin will be ignored as auto enables. this, however, should not be considered a normal operating mode. auto echo is shown schematically in figure 5C11. receiver transmitter tx enable rx enable dcd cts rxd txd n.c. local loopback figure 5C10. local loopback receiver transmitter tx enable rx enable dcd cts rxd txd auto echo n.c. figure 5C11. auto echo
6C1 chapter 6 register description 6.1 introduction 6C3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.2 write registers 6C5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.2.1 write register 0 (command register) 6C5 . . . . . . . . . . . . . . . . . . . . . . . . 6.2.2 write register 1 (transmit/receive interrupt and data transfer mode definition) 6C7 . . . . . . . . . . . . . . . . . . . . . . . . . . 6.2.3 write register 2 (interrupt vector) 6C9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.2.4 write register 3 (receive parameters and control) 6C10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.2.5 write register 4 (transmit/receiver miscellaneous parameters and modes) 6C11 . . . . . . . . . . . . . . . . . . . . . . . 6.2.6 write register 5 (transmit parameter and controls) 6C13 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.2.7 write register 6 (sync characters or sdlc address field) 6C15 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.2.8 write register 7 (sync character or sdlc flag/sdlc option register) 6C17 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.2.9 write register 8 (transmit buffer) 6C18 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.2.10 write register 9 (master interrupt control) 6C18 . . . . . . . . . . . . . . . . . . . . . 6.2.11 write register 10 (miscellaneous transmitter/ receiver control bits) 6C20 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.2.12 write register 11 (clock mode control) 6C23 . . . . . . . . . . . . . . . . . . . . . . . 6.2.13 write register 12 (lower byte of baud rate generator time constant) 6C26 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.2.14 write register 13 (upper byte of baud rate generator time constant) 6C26 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.2.15 write register 14 (miscellaneous control bits) 6C27 . . . . . . . . . . . . . . . . . . 6.2.16 write register 15 (external/status interrupt control) 6C29 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3 read registers 6C30 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3.1 read register 0 (transmit/receive buffer status and external status) 6C30 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3.2 read register 1 6C33 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3.3 read register 2 6C35 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3.4 read register 3 6C35 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3.5 read register 6 6C36 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3.6 read register 7 6C36 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3.7 read register 8 6C37 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3.8 read register 10 6C37 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3.9 read register 12 6C38 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3.10 read register 13 6C38 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3.11 read register 15 6C39 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
register description amd 6C2
6C3 register description chapter 6 6.1 introduction the following sections describe the scc registers. each register is detailed in terms of bit configuration, the active states (see table 6C1) of each bit, their definitions, their func- tions, and their effects upon the internal hardware and external pins.
register description amd 6C4 table 6C1. scc register description read register functions rr0 transmit/receive buffer status, and external status rr1 special receive condition status, residue codes, error conditions rr2 modified (channel b only) interrupt vector and unmodified interrupt vector (channel a only) rr3 interrupt pending bits (channel a only) *rr6 14-bit frame byte count (lsb) *rr7 14-bit frame byte count (msb), frame status rr8 receive buffer rr10 miscellaneous xmtr, rcvr status parameters rr12 lower byte of baud rate generator time constant rr13 upper byte of baud rate generator time constant rr15 external/status interrupt control information * available only when am85c30 is programmed in enhanced mode. write register functions wr0 command register, (register pointers), crc initialization, resets for various modes wr1 interrupt conditions, wait/dma request control wr2 interrupt vector (access through either channel) wr3 receive/control parameters, number of bits per character, rx crc enable wr4 transmit/receive miscellaneous parameters and codes, clock rate, number of sync characters, stop bits, parity wr5 transmit parameters and control, number of tx bits per character, tx crc enable wr6 sync character (1st byte) or sdlc address wr7 sync character (2nd byte) or sdlc flag **wr7 sdlc options; auto flag, rts, eom reset, extended read, etc. wr8 transmit buffer wr9 master interrupt control and reset (accessed through either channel), reset bits, control interrupt daisy chain wr10 miscellaneous transmitter/receiver control bits, nrzi, nrz, fm encoding, crc reset wr11 clock mode control, source of rx and tx clocks wr12 lower byte of baud rate generator time constant wr13 upper byte of baud rate generator time constant wr14 miscellaneous control bits: baud rate generator, phase-locked loop control, auto echo, local loopback wr15 external/status interrupt control information-control external conditions causing interrupts ** only available in am85c30.
register description amd 6C5 6.2 write registers the scc write register set for each channel includes ten control registers, two sync char- acter registers, two baud rate time constant registers, a transmit buffer, and a master in- terrupt register. the following sections describe in detail each write register and the associated bit configuration for each. 6.2.1 write register 0 (command register) wr0 is the command register and the crc reset code register. figure 6C1 shows the bit configuration for wr0. d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 00 00 01 01 00 01 10 11 null code reset rx crc checker reset tx crc generator reset tx underrun/eom latch 0 1 0 1 register 0 register 1 register 2 register 3 10 10 11 11 0 1 0 1 register 4 register 5 register 6 register 7 00 00 01 01 0 1 0 1 register 8 register 9 register 10 register 11 10 10 11 11 0 1 0 1 register 12 register 13 register 14 register 15 00 00 01 0 1 0 01 10 10 11 1 0 1 0 11 1 null code point high reset ext/status interrupts send abort (sdlc) enable int on next rx character reset txint pending error reset reset highest ius with point high command figure 6C1. write register 0
register description amd 6C6 bits d7 and d6: crc reset codes 0 and 1 null code (00) . this command has no effect on the scc and is used when a write to wr0 is necessary for some reason other than a crc reset command. reset receive crc checker (01) . this command is used to initialize the receive crc circuitry. it is necessary in synchronous modes (except sdlc) if the enter hunt mode command in write register 3 is not issued between received messages. any action that disables the receiver initializes the crc circuitry. also, whenever the receiver is in hunt mode, or whenever a flag is received, the crc checker will be automatically reset in sdlc mode. reset transmit crc generator (10) . this command initializes the crc generator. it is usually issued in the initialization routine and after the crc has been transmitted. a channel reset will not initialize the generator and this command should not be issued until after the transmitter has been enabled in the initialization routine. reset transmit underrun/eom latch (11) . this command controls the transmission of crc at the end of transmission (eom). if this latch has been reset, and a transmit under- run occurs, the scc automatically appends crc to the message. in sdlc mode with abort on underrun selected, the scc sends an abort, and flag on underrun if the tx un- derrun/eom latch has been reset. at the start of the crc transmission the tx underrun/eom latch is set. the reset com- mand can be issued at any time during a message. if the transmitter is disabled this com- mand will not reset the latch. however, if no external status interrupt is pending, or if a reset external status interrupt command accompanies this command while the transmit- ter is disabled, an external/status interrupt is generated with the tx underrun/eom bit reset in rro. bits d5Cd3: command codes null code (000) . the null command has no effect on the scc. point high (001) . this command effectively adds eight to the register pointer (d2Cd0) by allowing wr8 through wr15 to be accessed. the point high command and the reg- ister pointer bits are written simultaneously. reset external/status interrupts (010) . after an external/status interrupt (a change on a modem line or a break condition, for example), the status bits in rr0 are latched. this command enables the bits and allows interrupts to occur again as a result of a status change. latching the status bits captures short pulses until the cpu has time to read the change. the scc contains simple queuing logic associated with most of the external status bits in rr0. if another external/status condition changes while a previous condi- tion is still pending (reset external/status interrupts has not yet been issued) and this condition persists until after the command is issued, this second change causes another external/status interrupt. however, if this second status change does not persist (there are two transitions), another interrupt is not generated. exceptions to this rule are detailed in the rr0 description. send abort (011) . this command is used in sdlc mode to transmit a sequence of eight to thirteen 1s. this command always empties the transmit buffer and sets tx underrun/ eom bit in read register 0. enable interrupt on next rx character (100) . if the interrupt on the first received character mode is selected, this command is used to reactivate that mode after each message is received. the next character to enter the receive fifo causes a receive interrupt. alternatively, the first previously stored character in the fifo will cause a re- ceive interrupt. reset tx interrupt pending (101) . this command is used in cases where there are no more characters to be sent; e.g., at the end of a message. this command prevents fur- ther transmit interrupts until after the next character has been loaded into the transmit
register description amd 6C7 buffer or until crc has been completely sent. this command is necessary to prevent the transmitter from requesting an interrupt when the transmit buffer becomes empty again, (with transmit interrupt enabled) on the last data character transmitted. error reset (110) . this command resets the error bits in rr1. if interrupt on first rx character or interrupt on special condition modes are selected and a special condition exists, the data with the special condition is held in the receive fifo until this command is issued. if either of these modes is selected and this command is issued before the data have been read from the receive fifo, the data are lost. reset highest ius (111) . this command resets the highest priority interrupt under service (ius) bit, allowing lower priority conditions to request interrupts. this command allows the use of the internal daisy chain (even in systems without an external daisy chain) and should be the last operation in an interrupt service routine. bits 2 through 0: resister selection code these three bits select registers 0 through 7. with the point high command, registers 8 through 15 are selected. 6.2.2 write register 1 (transmit/receive interrupt and data transfer mode definition) write register 1 is the control register for the various scc interrupt and wait/request modes. figure 6C2 shows the bit assignments for wr1. bit 7: wait/dma request enable this bit enables the wait/request function in conjunction with the request/wait function select bit (d6). if bit 7 is set to 1, the state of bit 6 determines the activity of the wait / request pin (wait or request). if bit 7 is set to 0, the selected function (bit 6) forces the wait / request pin to the appropriate inactive state (high for request, floating for wait). bit 6: wait/dma request function the request function is selected by setting this bit to 1. in the dma request mode, the wait / request pin switches from high to low when the scc is ready to transfer data. when this bit is 0, the wait function is selected. in the wait mode, the wait / request pin switches from floating to low when the cpu attempts to transfer data before the scc is ready. bit 5: wait/dma request on receive transmit this bit determines whether the wait / request pin operates in the transmit mode or the receive mode. when set to 1, this bit allows the wait/request function to follow the state of the receive buffer; i.e., depending on the state of bit 6, the wait / request pin is active or inactive in relation to the empty or full state of the receive buffer. conversely, if this bit is set to 0, the state of the wait / request pin is determined by bit 6 and the state of the transmit buffer. (note that a transmit request function is available on the dtr / request pin. this allows full-duplex operation under dma control for both channels.) the request function may occur only when the scc is not selected; e.g., if the internal request becomes active while the scc is in the middle of a read or write cycle, the exter- nal request will not become active until the cycle is complete. an active request output causes a dma controller to initiate a read or write operation. if the request on transmit mode is selected in either sdlc or synchronous mode, the request pin is pulsed low for one pclk cycle at the end of crc transmission of another block of data. in the wait on receive mode, the wait pin is active if the cpu attempts to read scc data that have not yet been received. in the wait on transmit mode, the wait pin is ac- tive if the cpu attempts to write data when the transmit buffer is still full. both situations can occur frequently when block transfer instructions are used.
register description amd 6C8 bits 4 and 3: receive interrupt modes these two bits specify the various character-available conditions that may cause interrupt requests. receive interrupts disabled (00) . this mode prevents the receiver from requesting an interrupt and is normally used in a polled environment where either the status bits in rr0 or the modified vector in rr2 (channel b) can be monitored to initiate a service routine. although the receiver interrupts are disabled, a special condition can still provide a unique vector status in rr2. d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 00 01 10 11 rx int disable rx int on first character or special condition int on all rx characters or special condition rx int on special condition only ext int enable tx int enable parity is special condition wait/dma request on receive/ transmit wait /dma request function wait/dma request enable figure 6C2. write register 1 receive interrupt on first character or special condition (01) . the receiver requests an interrupt in this mode on the first available character (or stored fifo character) or on a special condition. sync characters to be stripped from the message stream do not cause interrupts. special receive conditions are: receiver overrun, framing error, end of frame, or parity error (if selected). if a special receive condition occurs, the data containing the error are stored in the receive fifo until an error reset command is issued by the cpu. this mode is usually selected when a block transfer mode is used. in this interrupt mode, a pending special receive condition remains set until either an error reset com- mand, a channel or hardware reset, or until receive interrupts are disabled. the receive interrupt on first character or special condition mode can be re-enabled by the enable rx interrupt on next character command in wr0. interrupt on all receive characters or special condition (10) . this mode allows an interrupt for every character received (or character in the receive fifo) and provides a unique vector when a special condition exists. the receiver overrun bit and the parity error bit in rr1 are two special conditions that are latched. these two bits must be reset by the error reset command. receiver overrun is always a special receive condition, and parity can be programmed to be a special condition. data characters with special receive conditions are not held in the receive fifo in the interrupt on all receive characters or special conditions mode as they are in other re- ceive interrupt modes.
register description amd 6C9 receive interrupt on special condition (11) . this mode allows the receiver to interrupt only on characters with a special receive condition. when an interrupt occurs, the data containing the error are held in the receive fifo until an error reset command is issued. when using this mode in conjunction with a dma, the dma can be initialized and enabled before any characters have been received by the scc. this eliminates the time-critical section of code required in the receive interrupt on first character or special condition mode; i.e., all data can be transferred via the dma so that the cpu need not handle the first received character as a special case. bit 2: parity is special condition if this bit is set to 1, any received characters with parity not matching the sense pro- grammed in wr4 give rise to a special receive condition. if parity is disabled (wr4), this bit is ignored. a special condition modifies the status of the interrupt vector stored in wr2. during an interrupt acknowledge cycle, this vector can be placed on the data bus. bit 1: transmitter interrupt enable if this bit is set to 1, the transmitter requests an interrupt whenever the transmit buffer becomes empty. bit 0: external/status master interrupt enable this bit is the master enable for external/status interrupts including dcd , cts , sync pins, break/abort, the beginning of crc transmission when the transmit/underrun/eom latch is set, or when the counter in the baud rate generator reaches 0. write register 15 contains the individual enable bits for each of these sources of external/status interrupts. this bit is reset by a channel or hardware reset. 6.2.3 write register 2 (interrupt vector) wr2 is the interrupt vector register. only one vector register exists in the scc, but it can be accessed through either channel. the interrupt vector can be modified by status infor- mation. this is controlled by the vector includes status (vis) and the status high/status low bits in wr9. when the register is accessed in channel a, the vector returned is the vector actually stored in wr2. when this register is accessed in channel b, the vector returned includes status information in bits 1, 2, and 3 or in bits 6, 5, and 4, depending on the state of the status high/status low bit in wr9 and independent of the state of vis bit in wr9. the bit positions for wr2 are shown in figure 6C3. d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 v 3 v 4 v 5 v 6 v 0 v 1 v 2 v 7 figure 6C3. write register 2
register description amd 6C10 6.2.4 write register 3 (receive parameters and control) this register contains the control bits and parameters for the receiver logic as illustrated in figure 6C4. this register is readable by executing a read to rr9 when d0 of wr15 and d6 of wr7 are set to 1. bits 7 and 6: receiver bits/character the state of these two bits determines the number of bits to be assembled as a character in the received serial data stream. table 6C2 lists the number of bits per character in the assembled character format. the number of bits per character can be changed while a character is being assembled, but only before the number of bits currently programmed is reached. unused bits in the received data register (rr8) are set to 1 in asynchronous modes. in synchronous modes and sdlc modes, the scc transfers an 8-bit section of the serial data stream to the receive fifo at the appropriate time. table 6C2. receive bits/character d 7 d 6 character length 0 0 5 bits/character 0 1 7 bits/character 1 0 6 bits/character 1 1 8 bits/character bit 5: auto enables this bit programs the function for both dcd and cts pins. cts becomes the transmitter enable and dcd becomes the receiver enable when this bit is set to 1. however, the receiver enable and transmit enable bits must be set before the dcd and cts pins can be used in this manner. when the auto enables bit is set to 0, the dcd and cts pins are merely inputs to the corresponding status bits in read register 0. the state of dcd is ignored in the local loopback mode. the state of cts is ignored in both auto echo and local loopback modes. if cts disables the transmitter during a byte transmission, the scc will still complete the byte transfer. bit 4: enter hunt mode this command forces the comparison of sync characters or flags for the purpose of syn- chronization. after reset, the scc automatically enters the hunt mode (except asynchro- nous). whenever a flag or sync character is matched, the sync/hunt bit in read register 0 is reset and, if external/status interrupt enable is set, an interrupt sequence is initiated. the scc automatically enters the hunt mode when an abort condition is received or when the receiver is disabled. bit 3: receiver crc enable this bit is used to initiate crc calculation at the beginning of the last byte transferred from the receiver shift register to the receive fifo. this operation occurs independently of the number of bytes in the receive fifo. when a particular byte is to be excluded from crc calculation, this bit should be reset before the next byte is transferred to the receive fifo. if this feature is used, care must be taken to ensure that eight bits per character is selected in the receiver because of an inherent delay from the receive shift register to the crc checker. this bit is internally set to 1 in sdlc mode and the scc calculates crc on all bits ex- cept inserted zeros between the opening and closing character flags. this bit is ignored in asynchronous modes.
register description amd 6C11 d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 00 01 10 11 rx 5 bits/character rx 7 bits/character rx enable sync character load inhibit address search mode (sdlc) rx crc enable enter hunt enable auto enables rx 6 bits/character rx 8 bits/character figure 6C4. write register 3 bit 2: address search mode (sdlc) setting this bit in sdlc mode causes messages with addresses not matching the ad- dress programmed in wr6 to be rejected. no receiver interrupts can occur in this mode unless there is an address match. the address that the scc attempts to match can be unique (1 in 256) or multiple (16 in 256), depending on the state of sync character load inhibit bit. the address search mode bit is ignored in all modes except sdlc. bit 1: sync character load inhibit if this bit is set to 1 in any synchronous mode except sdlc, the scc compares the byte in wr6 with the byte about to be stored in the fifo, and it inhibits this load if the bytes are equal. the scc does not calculate the crc on bytes stripped from the data stream in this manner. if the 6-bit sync option is selected while in monosync mode, the compare is still across eight bits, so wr6 must be programmed for proper operation. if the 6-bit sync option is selected with this bit set to 1, all sync characters except the one immediately preceding the data are stripped from the message. if the 6-bit sync option is selected while in the bisync mode, this bit is ignored. the address recognition logic of the receiver is modified in sdlc mode if this bit is set to 1; i.e., only the four most significant bits of wr6 must match the receiver address. this procedure allows the scc to receive frames from up to 16 separate sources without pro- gramming wr6 for each source (if each station address has the four most significant bits in common). the address field in the frame is still eight bits long. this bit is ignored in sdlc mode if address search mode has not been selected. bit 0: receiver enable when this bit is set to 1, receiver operation begins. this bit should be set only after all other receiver parameters are established and the receiver is completely initialized. this bit is reset by a channel or hardware reset command, and it disables the receiver. 6.2.5 write register 4 (transmit/receiver miscellaneous parameters and modes) wr4 contains the control bits for both the receiver and the transmitter. these bits should be set in the transmit and receiver initialization routine before issuing the contents of wr1, wr3, wr6, and wr7. bit positions for wr4 are shown in figure 6C5. this register is readable by executing a read to rr4 when d0 of wr15 and d6 of wr7 are set to 1.
register description amd 6C12 d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 00 01 10 11 x1 clock mode x16 clock mode x32 clock mode x64 clock mode parity enable parity even/odd sync modes enable 1 stop bit/character 1 1 / 2 stop bits/character 2 stop bits/character 00 01 10 11 00 01 10 11 8 bit sync character 16 bit sync character sdlc mode (01111110 flag) external sync mode figure 6C5. write register 4 bits 7 and 6: clock rate 1 and 0 these bits specify the multiplier between the clock and data rates. in synchronous modes, the 1x mode is forced internally and these bits are ignored unless external sync mode has been selected. 1x mode (00) . the clock rate and data rate are the same. in external sync mode, this bit combination specifies that only the sync pin can be used to achieve character synchro- nization. 16x mode (01) . the clock rate is 16 times the data rate. in external sync mode, this bit combination specifies that only the sync pin can be used to achieve character synchro- nization. 32x mode (10) . the clock rate is 32 times the data rate. in external sync mode, this bit combination specifies that either the sync pin or a match with the character stored in wr7 will signal character synchronization. the sync character can be either six or eight bits long as specified by the 6-bit/8-bit sync bit in wr10. 64x mode (11) . the clock rate is 64 times the data rate. with this bit combination in ex- ternal sync mode, both the receiver and transmitter are placed in sdlc mode. the only variation from normal sdlc operation is that the sync pin is used to start or stop the reception of a frame by forcing the receiver to act as though a flag had been received. bits 5 and 4: sync modes 1 and 0 these two bits select the various options for character synchronization. they are ignored unless synchronous modes are selected in the stop bits field of this register. monosync (00) . in this mode, the receiver achieves character synchronization by match- ing the character stored in wr7 with an identical character in the received data stream.
register description amd 6C13 the transmitter uses the character stored in wr6 as a time fill. the sync character can be either six or eight bits, depending on the state of the 6-bit/8-bit sync bit in wr10. if the sync character load inhibit bit is set, the receiver strips the contents of wr6 from the data stream if received within character boundaries. bisync (01) . the concatenation of wr7 with wr6 is used for receiver synchronization and as time fill by the transmitter. the sync character can be 12 or 16 bits in the receiver, depending on the state of the 6-bit/8-bit sync bit in wr10. the transmitted character is always 16 bits. sdlc mode (10) . in this mode, sdlc is selected and requires a flag (01111110) to be written to wr7. the receiver address field should be written to wr6. the sdlc crc polynomial must also be selected (wr5) in sdlc mode. external sync mode (11) . in this mode, the scc expects external logic to signal charac- ter synchronization via the sync pin. if the crystal oscillator option is selected (in wr11), the internal sync signal is forced to 0. also in this mode, bits d7Cd6 of this register select a special version of external sync mode. refer to synchronous external sync mode on page 4C41. the transmitter is in monosync mode using the contents of wr6 as the time fill with the sync character length specified by the 6-bit/8-bit sync bit in wr10. bits 3 and 2: stop bits 1 and 0 these bits determine the number of stop bits added to each asynchronous character that is transmitted. the receiver always checks for one stop bit in asynchronous mode. a special mode specifies that a synchronous mode is to be selected. d2 is always set to 1, by a channel or hardware reset to ensure that the sync pin is in a known state after a reset. synchronous modes enable (00) . this bit combination selects one of the synchronous modes specified by bits d4, d5, d6, and d7 of this register and forces the 1x clock mode internally. 1 stop bit/character (1) . this bit selects asynchronous mode with one stop bit per char- acter. 1 1 / 2 stop bits/character (10) . these bits select asynchronous mode with 1- 1 / 2 stop bits per character. this mode cannot be used with the 1x clock mode. 2 stop bits/character (11) . these bits select asynchronous mode with two stop bits per transmitted character and check for one received stop bit. bit 1: parity even/ odd this bit determines whether parity is checked as even or odd. a 1 programmed here selects even parity, and a 0 selects odd parity. this bit is ignored if the parity enable bit is not set. bit 0: parity enable when this bit is set, an additional bit position beyond those specified in the bits/character control is added to the transmitted data and is expected in the receive data. the re- ceived parity bit is transferred to the cpu as part of the data unless eight bits per charac- ter is selected in the receiver. 6.2.6 write register 5 (transmit parameter and controls) wr5 contains control bits that affect the operation of the transmitter. d2 affects both the transmitter and the receiver. bit positions for wr5 are shown in figure 6C6. this register is readable by executing a read to rr5 when d0 of wr15 and d6 of wr7 are set to 1.
register description amd 6C14 d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 tx crc enable rts sdlc /crc-16 send break 00 01 10 11 tx 5 bits (or less)/character tx 7 bits/character tx 6 bits/character tx 8 bits/character tx enable dtr figure 6C6. write register 5 bit 7: data terminal ready this is the control bit for the dtr / req pin while the pin is in the dtr mode (selected in wr14). when set, dtr is low; when reset, dtr is high. this bit is ignored when dtr / req is programmed to act as a request pin. this bit is reset by a channel or hardware reset. bits 6 and 5: tx bits/character 1 and 0 these bits control the number of bits in each byte transferred to the transmit buffer. bits sent must be right justified with least significant bits first. the five or less mode allows transmission of one to five bits per character; however, the cpu should format the data character as shown below in table 6C3. in the six or seven bits/character modes, unused data bits are ignored. bit 4: send break when set, this bit forces the txd output to send continuous 0s beginning with the follow- ing transmit clock, regardless of any data being transmitted at the time. this bit functions whether or not the transmitter is enabled. when reset, txd continues to send the con- tents of the transmit shift register, which might be syncs, data, or all 1s. if this bit is set while in the x21 mode (monosync and loop mode selected) and character synchroniza- tion is achieved in the receiver, this bit is automatically reset and the transmitter begins sending syncs or data. this bit can also be reset by a channel or hardware reset. table 6C3. transmit bits/character d 6 d 5 character length 0 0 5 or less bits/character 0 1 7 bits/character 1 0 6 bits/character 1 1 8 bits/character d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 transmitter 1111000d 0 sends one data bit 111000d 1 d 0 sends two data bits 11000d 2 d 1 d 0 sends three data bits 1000d 3 d 2 d 1 d 0 sends four data bits 000d 4 d 3 d 2 d 1 d 0 sends five data bits
register description amd 6C15 bit 3: transmit enable data is not transmitted until this bit is set, and the txd output sends continuous 1s un- less auto echo mode or sdlc loop mode is selected. if this bit is reset after transmis- sion has started, the transmission of data or sync characters is completed. if the transmitter is disabled during the transmission of a crc character, sync or flag charac- ters are sent instead of crc. this bit is reset by a channel or hardware reset. bit 2: sdlc /crc-16 this bit selects the crc polynomial used by both the transmitter and receiver. when set, the crc-16 polynomial is used; when reset, the sdlc polynomial is used. the sdlc / crc polynomial must be selected when sdlc mode is selected. the crc generator and checker can be preset to all 0s or all 1s, depending on the state of the preset 1/preset 0 bit in wr10. bit 1: request to send this is the control bit for the rts pin. when the rts bit is set, the rts pin goes low; when reset rts goes high. in the asynchronous mode with the auto enables bit set, rts goes high only after all bits of the character have been sent and the transmit buffer is empty. in synchronous modes or the asynchronous mode with auto enables off, the pin directly follows the state of this bit. this bit is reset by a channel or hardware reset. bit 0: transmit crc enable this bit determines whether or not crc is calculated on a transmit character. if this bit is set at the time the character is loaded from the transmit buffer to the transmit shift regis- ter, crc is calculated on that character. crc is not automatically sent unless this bit is set when the transmit underrun exists. 6.2.7 write register 6 (sync characters or sdlc address field) wr 6 is programmed to contain the transmit sync character in the monosync mode. the first byte of a 16-bit sync character in the external sync mode. wr6 is not used in asyn- chronous modes. in the sdlc modes, it is programmed to contain the secondary address field used to compare against the address field of the sdlc frame. in sdlc mode, the scc does not automatically transmit the station address at the beginning of a response frame. bit positions for wr6 are shown in figure 6C7.
register description amd 6C16 d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 sync 7 sync 1 sync 7 sync 3 adr 7 adr 7 sync 6 sync 0 sync 6 sync 2 adr 6 adr 6 sync 5 sync 5 sync 5 sync 1 adr 5 adr 5 sync 4 sync 4 sync 4 sync 0 adr 4 adr 4 sync 3 sync 3 sync 3 1 adr 3 x sync 2 sync 2 sync 2 1 adr 2 x sync 1 sync 1 sync 1 1 adr 1 x sync 0 sync 0 sync 0 1 adr 0 x monosync, 8 bits monosync, 6 bits bisync, 16 bits bisync, 12 bits sdlc sdlc (address range) figure 6C7. write register 6 d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 sync 7 sync 5 sync 15 sync 11 0 sync 6 sync 4 sync 14 sync 10 1 sync 5 sync 3 sync 13 sync 9 1 sync 4 sync 2 sync 12 sync 8 1 sync 3 sync 1 sync 11 sync 7 1 sync 2 sync 0 sync 10 sync 6 1 sync 1 x sync 9 sync 5 1 sync 0 x sync 8 sync 4 0 monosync, 8 bits monosync, 6 bits bisync, 16 bits bisync, 12 bits sdlc (flag) figure 6C8. write register 7
register description amd 6C17 6.2.8 write register 7 (sync character or sdlcflag/sdlc option register) note sdlc option register is available only in cmos version. in the nmos am8530h, the use of this register differs depending on the mode the scc is programmed in. in monosync mode, wr7 is programmed with the receive sync charac- ter; in bisync, it is programmed with the second byte (the last 8 bits) of the 16-bit sync character. in sdlc modes, wr7 is programmed with the flag character (01111110). note, however, that wr7 may hold the receive sync character or flag if one of the special versions of the external sync mode is selected. write register 7 (special sdlc enhancement register) in the cmos am8530, special sdlc options are provided that enable the user to more effectively interface to the am85c30. these options are available to the user if the previ- ously unused bit, d0 of wr15, is set to 1. when this bit is set, and the scc is pro- grammed for sdlc operation, an access to wr7 accesses a different register which allows the programming of these options. this register is referred to as wr7 (wr7 prime). resetting this bit (d0 of wr15) disables the options and the next access to wr7 is to the flag register. therefore, the user should always program the flag character first before setting bit d0 of wr15 to 1. this register is readable by executing a read to rr14 when d0 of wr15 and d6 of wr7 are set to 1. note that wr7 is not used in asynchronous mode. bit positions for wr7 are shown in figure 6C8. bit positions for wr7 are shown in figure 6C9 with bit descriptions given below. d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 txd forced high in sdlc nrzi mode dtr/req timing mode receive crc extended read enable auto tx flag auto eom reset auto rts deactivation this bit must always be programmed with a 0 figure 6C9. write register 7 bit 7: not used. this bit must be programmed with `0'. bit 6: extended read enable if this bit is set to 1 the user is able to read the following previously unreadable registers; wr3, wr4, wr5 and wr10 in the cmos scc in each channel. these registers are read by addressing bogus read registers rr9, rr4, rr5 and rr11, respectively. wr7 is updated or modified by writing to wr7 while this bit is set and is read by execut- ing a read cycle to wr14 (rr14). bit 5: receive crc if this bit is set to 1, the last two bits of the received crc are properly clocked into the receive shift register and are available to the user.
register description amd 6C18 bit 4: dtr / req timing mode this bit controls the timing of the dtr / req pin. if this bit is set to 1, the deactivation tim- ing of the dtr / req pin is made identical to the wait / req pin. bit 3: txd forced high in sdlc nrzi mode if this bit is set to 1, and the transmitter is disabled while the scc is programmed in sdlc mode with nrzi encoding, the txd pin will be pulled to a high physical state. bit 2: auto rts deactivation this bit synchronizes the deactivation of rts with the closing flag of an sdlc frame. if this bit is set to 1 and the user deactivates rts while the crc characters are being transmitted, the scc assures that the last bit of the flag character is transmitted before deactivating rts . bit 1: auto eom reset this bit removes the requirement of having to reset the tx underrun/eom latch during the transmission of a frame. if this bit is set to 1, the tx underrun/eom latch will be automatically reset by the scc after the first byte is transmitted. bit 0: auto tx flag this bit removes the requirement of having to wait for the mark idle and flag characters to be sent before the first data character of a new frame is written to the transmit buffer reg- ister (wr8). if this bit is set to 1, the user need only write the first character to the trans- mit buffer. the scc will then transmit the opening flag followed by data. 6.2.9 write register 8 (transmit buffer) wr8 is the transmit buffer register. 6.2.10 write register 9 (master interrupt control) wr9 is the master interrupt control register and contains the reset command bits. only one wr9 exists in the scc and can be accessed from either channel. the interrupt con- trol bits can be programmed at the same time as the reset command because these bits are reset only by a hardware reset. bit positions for wr9 are shown in figure 6C10. d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 00 01 10 11 no reset channel reset b channel reset a force hardware reset vis nv dlc mie status high/ status low interrupt masking without intack figure 6C10. write register 9
register description amd 6C19 bits 7 and 6: reset command bits together, these bits select one of the reset commands for the scc. setting either of these bits to 1 disables both the receiver and the transmitter in the corresponding chan- nel, forces txd for that channel marking, forces the modem control signals high in that channel, resets all ips and iuss and disables all interrupts in that channel. five extra pclk cycles must be allowed beyond the usual cycle time before any additional com- mand or controls are written to the scc. no reset (00) . this command has no effect. it is used when a write to wr9 is necessary for some reason other than an scc reset command. channel reset b (01) . issuing this command causes a channel reset to be performed on channel b. channel reset a (10) . issuing this command causes a channel reset to be performed on channel a. force hardware reset (11) . the effects of this command are identical to those of a hardware reset except that the mie, status high/status low and dlc bits take the pro- grammed values that accompany this command. bit 5: interrupt masking without intack if this bit is set to 1, the intack cycle is ignored by the scc and should be tied high. this allows users to mask lower priority interrupts in applications where intack is nei- ther necessary nor used. bit 4: status high/ status low this bit controls which vector bits the scc will modify to indicate status. when set to 1, the scc modifies bits v6, v5, and v4 according to table 6C4. when set to 0, the scc modifies bits v1, v2, and v3 according to table 6C1C3. this bit controls status in both the vector returned during an interrupt acknowledge cycle and the status in rr2b. this bit is reset by a hardware reset. bit 3: master interrupt enable the master interrupt enable bit is used to globally inhibit scc interrupts. when set to 1, interrupts for channel a and channel b are enabled. when this bit is set to 0, ieo is not forced low but follows the state of iei unless there is an ius set in the scc. no ius can be set after the mie bit is set to 0. this bit is reset by a hardware reset. table 6C4. interrupt vector modification v3 v2 v1 status high/status low=0 v4 v5 v6 status high/status low=1 0 0 0 ch b transmit buffer empty 0 0 1 ch b external/status change 0 1 0 ch b receive character available 0 1 1 ch b special receive condition 1 0 0 ch a transmit buffer empty 1 0 1 ch a external/status change 1 1 0 ch a receive character available 1 1 1 ch a special receive condition
register description amd 6C20 bit 2: disable lower chain the disable lower chain can be used by the cpu to control the interrupt daisy chain. setting this bit to 1 forces the ieo pin low, preventing lower-priority devices on the daisy chain from requesting interrupts. this bit is reset by a hardware reset. bit 1: no vector the no vector bit controls whether or not the scc will respond to an interrupt acknowl- edge cycle by placing a vector on the data bus if the scc is the highest-priority device requesting an interrupt. if this bit is set, no vector is returned; i.e., d0Cd7 remain three- stated during an interrupt acknowledge cycle, even if the scc is the highest-priority de- vice requesting an interrupt. bit 0: vector includes status the vector includes status bit controls whether or not the z-scc will include status infor- mation in the vector it places on the bus in response to an interrupt acknowledge cycle. if this bit is set, the vector returned is variable, with the variable field depending on the high- est-priority ip that is set. table 6C4 shows the encoding of the status information. this bit is ignored if the no vector (nv) bit is set and does not apply if rr2 is read from chan- nel b. 6.2.11 write register 10 (miscellaneous transmitter/ receiver control bits) wr10 contains miscellaneous control bits for both the receiver and the transmitter. bit positions for wr10 are shown in figure 6C11. this register is readable by executing a read to rr11 when d0 of wr15 and d6 of wr7 are set to 1. d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 6 bit/8bit sync loop mode abort/flag on underrun go active on poll 00 01 10 11 nrz nrzi fm1 (transition = 1) fm0 (transition = 0) mark/flag idle crc preset 1 or 0 figure 6C11. write register 10
register description amd 6C21 1 100101 transmit clock data nrz nrzi fm1 fm0 receive clock nrz 1 100101 data nrzi fm1 fm0 bit cell bit cell figure 6C12. nrz (nrzi) fm1 (fm0) timing bit 7: crc presets `1' or `0' this bit specifies the initialized condition of the receive crc checker and the transmit crc generator. if this bit is set to 1, the crc generator and checker are preset to 1. if this bit is set to 0, the crc generator and checker are preset to 0. either option can be selected with either crc polynomial. in sdlc mode, the transmitted crc is inverted be- fore transmission and the received crc is checked against the bit pattern 0001110100001111. this bit is reset by a channel or hardware reset. this bit is ignored in asynchronous mode. bits 6 and 5: data encoding 1 and 2 these bits control the coding method used for both the transmitter and the receiver, as illustrated in table 6C5. all of the clocking options are available for all coding methods. the dpll in the scc is useful for recovering clocking information in nrzi and fm modes. any coding method can be used in the x1 mode. a hardware reset forces nrz mode. timing for the various modes is shown in figure 6C12.
register description amd 6C22 table 6C5. data encoding d 6 d 5 encoding 0 0 nrz 0 1 nrzi 1 0 fm1 (transition = 1) 1 1 fm0 (transition = 0) bit 4: go active on poll when loop mode is first selected during sdlc operation, the scc connects rxd to txd with only gate delays in the path. the scc does not go on-loop and insert the 1-bit delay between rxd and txd until this bit has been set and an eop received. when the scc is on-loop, the transmitter is active in sdlc loop mode and is sending a flag. if this bit is set at the time the flag is leaving the transmit shift register, another flag or data byte (if the transmit buffer is full) is transmitted. if the go active on poll bit is not set at this time, the transmitter finishes sending the flag and reverts to the 1-bit delay mode. thus, to transmit only one response frame, this bit should be reset after the first data byte is sent to the scc but before crc has been transmitted. if the bit is not reset before crc is transmitted, extra flags are sent, slowing down response time on the loop. if this bit is re- set before the first data is written, the scc completes the transmission of the present flag and reverts to the 1-bit delay mode. after gaining control of the loop, the scc is not able to transmit again until a flag and another eop have been received. though not strictly necessary, it is good practice to set this bit only upon receipt of a poll frame to ensure that the scc does not go on-loop without the cpu noticing it. in synchronous modes other than sdlc with the loop mode bit set, this bit must be set before the transmitter can go active in response to a received sync character. this bit is always ignored in asynchronous mode and synchronous modes unless the loop mode bit is set. this bit is reset by a channel or hardware reset. bit 3: mark/ flag idle this bit affects only sdlc operation and is used to control the idle line condition. if this bit is set to 0, the transmitter sends flags as an idle line. if this bit is set to 1, the trans- mitter sends continuous 1s after the closing flag of a frame. the idle line condition is se- lected byte by byte; i.e., either a flag or eight 1s are transmitted. the primary station in an sdlc loop should be programmed for mark idle to create the eop sequence. mark idle must be deselected at the beginning of a frame before the first data are written to the scc, so that an opening flag can be transmitted. this bit is ignored in loop mode, but the programmed value takes effect upon exiting the loop mode. this bit is reset by a channel or hardware reset.
register description amd 6C23 bit 2: abort/ flag on underrun this bit affects only sdlc operation and is used to control how the scc responds to a transmit underrun condition. if this bit is set to 1 and a transmit underrun occurs, the scc sends an abort and a flag instead of crc. if the bit is reset, the scc sends crc on a transmit underrun. at the beginning of this 16-bit transmission, the transmit underrun/ eom bit is set, causing an external/status interrupt. the cpu uses this status, along with the byte count from memory or the dma, to determine whether the frame must be retransmitted. a transmit buffer empty interrupt occurs at the end of this 16-bit transmis- sion to start the next frame. if both this bit and the mark/flag idle bit are set to 1, all 1s are transmitted after the transmit underrun. this bit should be set after the first byte of data is sent to the scc and reset immediately after the last byte of data so that the frame will be terminated properly with crc and a flag. this bit is ignored in loop mode, but the programmed value is active upon exiting loop mode. this bit is reset by a channel or hardware reset. bit 1: loop mode in sdlc mode, the initial set condition of this bit forces the scc to connect txd to txd and to begin searching the incoming data stream so that it can go on-loop. all bits perti- nent to sdlc mode operation in other registers must be set before this mode is selected. the transmitter and receiver should not be enabled until after this mode has been se- lected. as soon as the go active on poll bit is set and an eop is received, the scc goes on-loop. if this bit is reset after the scc is on-loop, the scc waits for the next eop to go off-loop. in synchronous modes, the scc uses this bit, along with the go active on poll bit, to synchronize the transmitter to the receiver. the receiver should not be enabled until after this mode is selected. the txd pin is held marking when this mode is selected unless a break condition is programmed. the receiver waits for a sync character to be received and then enables the transmitter on a character boundary. the break condition, if pro- grammed, is removed. this mode works properly with sync characters of 6, 8, or 16 bits. this bit is ignored in asynchronous mode and is reset by a channel or hardware reset. bit 0: 6 bit/ 8 bit sync this bit is used to select a special case of synchronous modes. if this bit is set to 1 in monosync mode, the receiver and transmitter sync characters are six bits long instead of the usual eight. if this bit is set to 1 in bisync mode, the received sync will be 12 bits and the transmitter sync character will remain 16 bits long. this bit is ignored in sdlc and asynchronous modes but still has effect in the special external sync modes. this bit is reset by a channel or hardware reset. 6.2.12 write register 11 (clock mode control) wr11 is the clock mode control register. the bits in this register control the sources of both the receive and transmit clocks, the type of signal on the sync and rtxc pins, and the direction of the trxc pin. bit positions for wr11 are shown in figure 6C13.
register description amd 6C24 d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 00 01 10 11 receive clock = rtxc pin receive clock = trxc pin receive clock = br generator output receive clock = dpll output trxc out = xtal output trxc out = transmit clock trxc out = br generator output trxc out = dpll output 00 01 10 11 00 01 10 11 transmit clock = rtxc pin transmit clock = trxc pin transmit clock = br generator output transmit clock = dpll output trxc o/i rtxc xtal/no xtal figure 6C13. write register 11 bit 7: rtxcxtal/ no xtal this bit controls the type of input signal the scc expects to see on the rtxc pin. if this bit is set to 0, the scc expects a ttl-compatible signal as an input to this pin. if this bit is set to 1, the scc connects a high-gain amplifier between the rtxc and sync pins in expectation of a quartz crystal being placed across the pins. the output of this oscillator is available for use as a clocking source. in this mode of op- eration, the sync pin is unavailable for other use. the sync signal is forced to 0 inter- nally. a hardware reset forces no xtal. (at least 20 ms should be allowed after this bit is set to allow the oscillator to stabilize.) bits 6 and 5: receiver clock 1 and 0 these bits determine the source of the receive clock as shown in table 6C6. they do not interfere with any of the modes of operation in the scc but simply control a multiplexer just before the internal receive clock input. a hardware reset forces the receive clock to come from the trxc pin. table 6C6. receive clock source d 6 d 5 0 0 receive clock = rtxc pin 0 1 receive clock = trxc pin 1 0 receive clock = brg output 1 1 receive clock = dpll output
register description amd 6C25 bits 4 and 3: transmit clock 1 and 0 these bits determine the source of the transmit clock as shown in table 6C7. they do not interfere with any of the modes of operation of the scc but simply control a multiplexer just before the internal transmit clock input. the dpll output that may be used to feed the transmitter in fm modes lags by 90 the output of the dpll used by the receiver. this makes the received and transmitted bit cells occur simultaneously, neglecting delays. a hardware reset selects the trxc pin as the source of the transmit clocks. table 6C7. transmit clock source d 4 d 3 0 0 transmit clock = rtxc pin 0 1 transmit clock = trxc pin 1 0 transmit clock = brg output 1 1 transmit clock = dpll output bit 2: trxc o/i this bit determines the direction of the trxc pin. if this it is set to 1, the trxc pin is an output and carries the signal selected by d1 and d0 of this register. however, if either the receive or the transmit clock is programmed to come from the trxc pin, trxc will be an input, regardless of the state of this bit. the trxc pin is also an input if this bit is set to 0. a hardware reset forces this bit to 0. bits 1 and 0: trxc output source 1 and 0 these bits determine the signal to be echoed out of the scc via the trxc pin. no signal is produced if trxc has been programmed as the source of either the receive or the transmit clock. if trxc o/i (bit 2) is set to 0, these bits are ignored. if the xtal oscillator output is programmed to be echoed, and the xtal oscillator has not been enabled, the trxc pin hoes high. the dpll signal that is echoed is the dpll signal used by the receiver. hardware reset selects the xtal oscillator as the output source. table 6C8. transmit external control selection d 1 d 0 00 trxc = xtal oscillator output 01 trxc = transmit clock 10 trxc = brg output 11 trxc = dpll output
register description amd 6C26 6.2.13 write register 12 (lower byte of baud rate generator time constant) wr12 contains the lower byte of the time constant for the baud rate generator. the time constant can be changed at any time, but the new value does not take effect until the next time the time constant is loaded into the down counter. no attempt is made to synchro- nize the loading of the time constant into wr12 and wr13 with the clock driving the down counter. for this reason, it is advisable to disable the baud rate generator while the new time constant is loaded into wr12 and wr13. ordinarily, this is done anyway to pre- vent a load of the down counter between the writing of the upper and lower bytes of the time constant. the formula for determining the appropriate time constant for a given baud is shown be- low with the desired rate in bits per second and the br clock period in seconds. this for- mula is derived because the counter decrements from n down to 0-plus-one-cycle for reloading the time constant and is then fed to a toggle flip-flop to make the output a square wave. bit positions for wr12 are shown in figure 6C14. time constant = 1 2 (desired rate) (baud rate) C2 d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 tc 3 tc 4 tc 5 tc 6 tc 0 tc 1 tc 2 tc 7 lower byte of time constant figure 6C14. write register 12 6.2.14 write register 13 (upper byte of baud rate generator time constant) wr13 contains the upper byte of the time constant for the baud rate generator. bit posi- tions for wr13 are shown in figure 6C15.
register description amd 6C27 d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 tc 11 tc 12 tc 13 tc 14 tc 8 tc 9 tc 10 tc 15 upper byte of time constant figure 6C15. write register 13 6.2.15 write register 14 (miscellaneous control bits) wr14 contains some miscellaneous control bits. bit positions for wr14 are shown in fig- ure 6C16. d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 br generator enable br generator source dtr/request function local loopback auto echo 00 00 01 0 1 0 01 10 10 11 1 0 1 0 11 1 null command enter search mode reset missing clock disable dpll set source = br generator set source = rtxc set fm mode set nrzi mode dpll commands figure 6C16. write register 14 bits 7 and 5: digital phase-locked loop command bits these three bits encode the eight commands for the digital phase-locked loop. a chan- nel or hardware reset disables the dpll, resets the missing clock latches, sets the source to the rtxc pin and selects nrzi mode. the enter search mode command en- ables the dpll after a reset. null command (000). this command has no effect on the dpll.
register description amd 6C28 enter search mode (001) . issuing this command causes the dpll to enter the search mode, where the dpll searches for a locking edge in the incoming data stream. the ac- tion taken by the dpll upon receipt of this command depends on the operating mode of the dpll. in nrzi mode, the output of the dpll is high while the dpll is waiting for an edge in the incoming data stream. after the search mode is entered, the first edge the dpll sees is assumed to be a valid data edge, and the dpll begins the clock recovery operation from that point. the dpll clock rate must be 32 times the data rate in nrzi mode. upon leav- ing the search mode, the first sampling edge of the dpll occurs 16 of these 32x clocks after the first data edge and the second sampling edge occurs 48 of these 32x clocks after the first data edge. beyond this point, the dpll begins normal operation, adjusting the output to remain in sync with the incoming data. in fm mode, the output of the dpll is low while the dpll is waiting for an edge in the incoming data stream. the first edge the dpll detects is assumed to be a valid clock edge. for this to be the case, the line must contain only clock edges; i.e., with fm1 en- coding, the line must be continuous 0s. with fm0 encoding the line must be continuous 1s, whereas manchester encoding requires alternating 1s and 0s on the line. the dpll clock rate must be 16 times the data rate in fm mode. the dpll output causes the receiver to sample the data stream in the nominal center of the two halves of the bit cell to decide whether the data was a 1 or a 0. after this command is issued, as in nrzi mode, the dpll starts sampling immediately after the first edge is detected. (in fm mode, the dpll examines the clock edge of every other bit cell to decide what correction must be made to remain in sync.) if the dpll does not see an edge during the expected window, the one clock missing bit in rr10 is set. if the dpll does not see an edge after two successive attempts, the two clocks missing bit in rr10 is set and the dpll auto- matically enters the search mode. this command resets both clock missing latches. reset clock missing (010) . issuing this command disables the dpll, resets the clock missing latches in rr10, and forces a continuous search mode state. disable dpll (011) . issuing this command disables the dpll, resets the clock missing latches in rr10, and forces a continuous search mode state. set source = br gen (100) . issuing this command forces the clock for the dpll to come from the output of the baud rate generator. set source = rtxc (101) . issuing this command forces the clock for the dpll to come from the rtxc pin or the crystal oscillator, depending on the state of the xtal/no xtal bit in wr11. this mode is selected by a channel or hardware reset. set fm mode (110) . this command forces the dpll to operate in the fm mode and is used to recover the clock from fm or manchester-encoded data. (manchester is decoded by placing the receiver in nrz mode while the dpll is in fm mode.) set nrzi mode (111) . issuing this command forces the dpll to operate in the nrzi mode. this mode is also selected by a hardware or channel reset. bit 4: local loopback setting this bit to 1 selects the local loopback mode of operation in this mode, the in- ternal transmitted data are routed back to the receiver, as well as to the txd pin. the cts and dcd inputs are ignored as enables in local loopback mode, even if auto en- ables is selected. (if so programmed, transitions on these inputs still cause interrupts.) this mode works with any transmit/receive mode except loop mode. for meaningful results, the frequency of the transmit and receive clocks must be the same. this bit is re- set by a channel or hardware reset. bit 3: auto echo setting this bit to 1 selects the auto enable mode of operation. in this mode, the txd pin is connected to rxd, as in local loopback mode, but the receiver still listens to the
register description amd 6C29 rxd input. transmitted data are never seen inside or outside the scc in this mode, and cts is ignored as a transmit enable. this bit is reset by a channel or hardware reset. bit 2: dtr/transmit dma request function this bit selects the function of the dtr / req pin. if this bit is set to 0, the dtr / req pin follows the inverted state of the dtr bit in wr5. if this bit is set to 1, the dtr / req pin goes low whenever the transmit buffer becomes empty and in any of the synchronous modes when crc has been sent at the end of a message. the request function on the dtr / req pin differs from the transmit request function available on the w / req pin in that request does not go inactive until the internal operation satisfying the request is complete, which occurs four to five pclk cycles after the rising edge of read or write. if the dma used is edge-triggered, this difference is unimportant. this bit is reset by a channel or hardware reset. bit 1: baud rate generator source this bit selects the source of the clock for the baud rate generator. if this bit is set to 0, the baud rate generator clock comes from either the rtxc pin or the xtal oscillator (de- pending on the state of the xtal/no xtal bit). if this bit is set to 1, the clock for the baud rate generator is the sccs pclk input. hardware reset sets this bit to 0, select- ing the rtxc pin as the clock source for the baud rate generator. bit 0: baud rate generator enable this bit controls the operation of the baud rate generator. the counter in the baud rate generator is enabled for counting when this bit is set to 1, and counting is inhibited when this bit is set to 0. when this bit is set to 1, change in the state of this bit is not reflected by the output of the baud rate generator for two counts of the counter. this allows the command to be synchronized. however, when set to 0, disabling is immediate. this bit is reset by a hardware reset. 6.2.16 write register 15 (external/status interrupt control) wr15 is the external/status source control register. if the external/status interrupts are enabled as a group via wr1, bits in this register control which external/status conditions can cause an interrupt. only the external/status conditions that occur after the controlling bit is sent to 1, will cause an interrupt. this is true even if an external/status condition is pending at the time the bit is set. bit positions for wr15 are shown in figure 6C17. d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 dcd ie sync/hunt ie cts ie tx underrun/eom ie sdlc/hdlc enhancement enable zero count ie 10 x 19-bit frame status fifo enable break/abort ie figure 6C17. write register 15
register description amd 6C30 bit 7: break/abort ie if this bit is set to 1, a change in the break/abort status of the receiver causes an exter- nal/status interrupt. this bit is set by a channel or hardware reset. bit 6: tx underrun/eom if this bit is set to 1, a change of state by the tx underrun/eom latch in the transmitter causes an external/status interrupt. this bit is set to 1 by a channel or hardware reset. bit 5: cts ie if this bit is set 1, a change of state on the cts pin causes an external/status interrupt. this bit is set by a channel or hardware reset. bit 4: sync/hunt ie if this bit is set to 1, a change of state on the sync pin causes an external/status inter- rupt in asynchronous mode, and a change of state in the hunt bit in the receiver causes an external/status interrupt in synchronous modes. this bit is set by a channel or hard- ware reset. bit 3: dcd ie if this bit is set to 1, a change of state on the dcd pin causes an external/status inter- rupt. this bit is set by a channel or hardware reset. bit 2 10x19Cbit frame status fifo enable if this bit is set to 1, the 10x19-bit fifo array and 14-bit counter are available for use but only if the scc is programmed in sdlc mode. bit 1: zero count ie if this bit is set to 1, an external/status interrupt is generated whenever the counter in the baud rate generator reaches 0. this bit is set to 0 by a channel or hardware reset. bit 0: sdlc/hdlc enhancement enable if this bit is set to 1, wr7 can be accessed as wr7 to allow the use of special sdlc/ hdlc options. refer to wr7 for details. 6.3 read registers the scc contains nine read registers in each channel. the status of these registers is continually changing and depends on the mode of communication, received and transmit- ted data, and the manner in which this data is transferred to and from the cpu. the fol- lowing description details the bit assignments for each register. 6.3.1 read register 0 (transmit/receive buffer status and external status) read register 0 contains the status of the receive and transmit buffers. rr0 also con- tains the status bits for the six sources of external/status interrupts. the bit configuration is illustrated in figure 6C18.
register description amd 6C31 d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 dcd sync/hunt cts tx underrun/eom rx character available zero count tx buffer empty break/abort figure 6C18. read register 0 bit 7: break/abort in the asynchronous mode, this bit is set when a break sequence (null character plus framing error) is detected in the receive data stream. this bit is reset when the sequence is terminated, leaving a single null character in the receive fifo. this character should be read and discarded. in sdlc mode, this bit is set by the detection of an abort se- quence (seven or more 1s), then reset automatically at the termination of the abort se- quence. in either case, if the break/abort ie bit is set, an external/status interrupt is initiated. unlike the remainder of the external/status bits, both transitions are guaranteed to cause an external/status interrupt, even if another external/status interrupt is pending at the time these transitions occur. this procedure is necessary because abort or break conditions may not persist. bit 6: tx underrun/eom this bit is set by a channel or hardware reset and when the transmitter is disabled or a send abort command is issued. this bit can be reset only by the reset tx underrun/eom latch command in wr0. when the transmit underrun occurs, this bit is set and causes an external/status interrupt (if the tx underrun/eom ie bit is set). only the 0-to-1 transition of this bit causes an interrupt. this bit is always 1 in asynchro- nous mode, unless a reset tx underrun/eom latch command has been erroneously is- sued. in this case, the send abort command can be issued to set the bit to 1 and at the same time cause an external/status interrupt. bit 5: clear to send if the cts ie bit in wr15 is set, this bit indicates the state of the cts pin the last time any of the enabled external/status bits changed. any transition on the cts pin while no other interrupt is pending latches the state of the cts pin and generates an external/ status interrupt. any odd number of transitions on the cts pin while another external/ status interrupt is pending also causes an external/status interrupt condition. if the cts ie bit is reset, it merely reports the current unlatched state of the cts pin (i.e., if cts pin is low, this bit will be high). bit 4: sync/hunt the operation of this bit is similar to that of the cts bit, except that the condition moni- tored by the bit varies depending on the mode in which the scc is operating. when the xtal oscillator option is selected in asynchronous modes, this bit is forced to 0 (no external/status interrupt is generated). selecting the xtal oscillator in synchro- nous or sdlc modes has no effect on the operation of this bit.
register description amd 6C32 the xtal oscillator should not be selected in external sync mode. in asynchronous mode, the operation of this bit is identical to that of the cts status bit, except that this bit reports the state of the sync pin. in external sync mode the sync pin is used by external logic to signal character syn- chronization. when the enter hunt mode command is issued in external sync mode, the sync pin must be held high by external sync logic until character synchronization is achieved. a high on the sync pin holds the sync/hunt bit in the reset condition. when external synchronization is achieved, sync must be driven low on the second rising edge of the receive clock after the last rising edge of the receive clock on which the last bit of the receive character was received. once sync is forced low, it is good practice to keep it low until the cpu informs the external sync logic that synchronization has been lost or that a new message is about to start. both transitions on the sync pin case external/status interrupts if the sync/hunt ie bit is set to 1. the enter hunt mode command should be issued whenever character synchronization is lost. at the same time, the cpu should inform the external logic that character synchroni- zation has been lost and that the scc is waiting for sync to become active. in the monosync and bisync receive modes, the sync/hunt status bit is initially set to 1 by the enter hunt mode command. the sync/hunt bit is reset when the scc establishes character synchronization. both transitions cause external/status interrupts if the sync/ hunt ie bit is set when the cpu detects the end of message or the loss of character syn- chronization. when the cpu detects the end of message of the loss of character synchronization, the enter hunt mode command should be issued to set the sync/hunt bit and cause an external/status interrupt. in this mode, the sync pin is an output, which goes low every time a sync pattern is detected in the data stream. in the sdlc modes, the sync/hunt bit is initially set by the enter hunt mode command or when the receiver is disabled. it is reset when the opening flag of the first frame is de- tected by the scc. an external/status interrupt is also generated if the sync/hunt ie bit is set. unlike the monosync and bisync modes, once the sync/hunt bit is reset in sdlc mode, it does not need to be set when the end of the frame is detected. the scc auto- matically maintains synchronization. the only way the sync/hunt bit can be set again is by the enter hunt mode command or by disabling the receiver. bit 3: data carrier detect if the dcd ie bit in wr 15 is set, this bit indicates the state of the dcd pin the last time the enabled external/status bits changed. any transition on the dcd pin while no inter- rupt is pending latches the state of the dcd pin and generates an external/status inter- rupt. any odd number of transitions on the dcd pin while another external/status interrupt is pending also causes an external/status interrupt condition. if the dcd ie is reset, this bit merely reports the current, unlatched state of the dcd pin. bit 2: tx buffer empty this bit is set to 1 when the transmit buffer is empty. it is reset while crc is sent in a synchronous or sdlc mode and while the transmit buffer is full. the bit is reset when a character is loaded into the transmit buffer. this bit is always in the set condition after a hardware or channel reset. bit 1: zero count if the zero count interrupt enable bit is set in wr15, this bit is set to one while the counter in the baud rate generator is at the count zero. if there is no other external/status interrupt condition pending at the time this bit is set, an external/status interrupt is gener- ated. however, if there is another external/status interrupt pending at this time, no inter- rupt is initiated until interrupt service is complete. if the zero count condition does not persist beyond the end of the interrupt service routine, no interrupt will be generated. this bit is not latched high, even though the other external/status latches close as a result of
register description amd 6C33 the low-to-high transition on zc. the interrupt service routing should check the other external/status conditions for changes. if none changed, zc was the source. in polled applications, check the ip bit in rr3a for a status change and then proceed as in the in- terrupt service routine. bit 0: rx character available this bit is set to 1 when at least one character is available in the receive fifo and is reset when the receive fifo is completely empty. a channel or hardware reset empties the receive fifo. 6.3.2 read register 1 rr1 contains the special receive condition status bits and the residue codes for the i- field in sdlc mode. figure 6C19 shows the bit positions for rr1. d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 residue code 0 parity error rx overrun error crc/framing error all sent residue code 2 residue code 1 end of frame (sdlc) * modified in b channel. figure 6C19. read register 1 bit 7: end of frame (sdlc) this bit is used only in sdlc mode and indicates that a valid closing flag has been re- ceived and that the crc error bit and residue codes are valid. this bit can be reset by issuing the error reset command. it is also updated by the first character of the following frame. this bit is reset in any mode other than sdlc. bit 6: crc/framing error if a framing error occurs (in asynchronous mode), this bit is set (and not latched) for the receive character in which the framing error occurred. detection of a framing error adds an additional one-half bit to the character time so that the framing error is not interpreted as a new start bit. in synchronous and sdlc modes, this bit indicates the result of com- paring the crc checker to the appropriate check value. this bit is reset by issuing an error reset command, but the bit is never latched. therefore, it is always updated when the next character is received. when used for crc error status in synchronous or sdlc modes, this bit is usually set since most bit combinations, except for a correctly com- pleted message, result in a non-zero crc. the crc bit is valid only if crc is enabled and if the second byte of the crc is at the top of the receive data fifo. if the frame status fifo is enabled and contains at least one frame of data, then the crc bit of the frame status fifo (note that this register is physically different from the standard rr1) will be valid. note that the crc bytes could
register description amd 6C34 have been read out by a dma controller independently from the cpu but the crc status is still available in the frame status fifo. bit 5: receiver overrun error this bit indicates that the receive fifo has overflowed. only the character that has been written over is flagged with this error, and when the character is read, the error condition is latched until reset by the error reset command. the overrun character and all subse- quent characters received until the error reset command is issued causes a special re- ceive condition vector to be returned. bit 4: parity error when parity is enabled, this bit is set for the characters whose parity does not match the programmed sense (even/odd). this bit is latched so that once an error occurs, it remains set until the error reset command is issued. if the parity in special condition bit is set, a parity error causes a special receive condition vector to be returned on the character containing the error and on all subsequent characters until the error reset command is issued. bits 3, 2, and 1: residue codes 2, 1, and 0 in those cases in sdlc mode where the received i-field is not an integral multiple of the character length, these three bits indicate the length of the i-field and are meaningful only for the transfer in which the end of frame bit is set. this field is set to 011 by a channel or hardware reset and is forced to this state in asynchronous mode. these three bits can leave this state only if sdlc is selected and a character is received. the codes signify the following (reference table 6C9) when a receive character length is eight bits per character. i-field bits are rightCjustified in all cases. if a receive character length other than eight bits is used for the i-field, a table similar to table 6C9 can be constructed for each different character length. table 6C10 shows the residue codes for no residue (the i-field bound- ary lies on a character boundary). table 6C9. i-field bit selection (8 bits only) i-field i-field residue residue residue bits in bits in 0 1 2 last byte previous byte 100 0 3 010 0 4 110 0 5 001 0 6 101 0 7 011 0 8 111 1 8 000 2 8
register description amd 6C35 table 6C10. residue bits/character residue residue residue bits/char 0 1 2 801 1 700 0 601 0 500 1 bit 0: all sent in asynchronous mode, this bit is set when all characters have completely cleared the transmitter. most modems contain additional delays in the data path, which require the modem control signals remain active until after the data have cleared both the transmitter and the modem. this bit is always set in synchronous and sdlc modes. 6.3.3 read register 2 rr2 contains the interrupt vector written into wr2. when the register is accessed in channel a, the vector returned is the vector actually stored in wr2. when this register is accessed in channel b, the vector returned includes status information in bits 1, 2, and 3 or in bits 6, 5, and 4, depending on the state of the status high/status low bit in wr9 and independent of the state of vis bit in wr9. the vector is modified according to table 6C4 shown in the explanation of the vis bit in wr9. if no interrupts are pending, the status is v3, v2, v1 = 011, or v6, v5, v4 = 110. only one vector register exists in the scc, but it can be accessed through either channel. figure 6C20 shows the bit positions for rr2. d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 v 3 v 4 v 5 v 6 v 0 v 1 v 2 v 7 interrupt vector* *modified in b channel figure 6C20. read register 2 6.3.4 read register 3 rr3 is the interrupt pending register. the status of each of the interrupt pending bits in the scc is reported in this register. this register exists only in channel a. if this register is accessed in channel b, all 0s are returned. the two unused bits are always returned as 0. figure 6C21 shows the bit positions for rr3.
register description amd 6C36 d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 channel a ext/stat ip channel a tx ip channel a rx ip 0 channel b ext/stat ip channel b tx ip channel b rx ip 0 always 0 in b channel figure 6C21. read register 3 6.3.5 read register 6 when the scc is programmed for sdlc operation and bit d2 of wr15 is set to 1, rr6 contains the lsb of a frame byte count stored in the 10x19-bit fifo array as shown in figure 6C22. d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 figure 6C22. read register 6 6.3.6 read register 7 when the scc is programmed for sdlc operation and bit d2 of wr15 is set to 1, rr7 contains the msb of a frame byte count stored in the 10x19-bit fifo array, and provides fifo status via bits d7 and d6 as shown in figure 6C23. bit d7 is set to 1 when the 10x19-bit fifo overflows; otherwise it is set to 0. bit d6 is used to determine if status data will be from the fifo or directly from the 8-bit status fifo (rr1). this bit is set to 1 whenever the 10x19-bit fifo is not empty; otherwise it is 0. d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 fifo data available status 1 = status reads come from 10 x 9 bit fifo 0 = status reads come from scc msb byte count fifo overflow status 1 = fifo overflowed during operation 0 = normal figure 6C23. read register 7
register description amd 6C37 6.3.7 read register 8 rr8 is the receive data register. 6.3.8 read register 10 rr10 contains some miscellaneous status bits. unused bits are always 0. bit positions for rr10 are shown in figure 6C24. d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 0 loop sending 0 two clocks missing 0 on loop 0 one clock missing figure 6C24. read register 10 bit 7: one clock missing while operating in the fm mode, the dpll sets this bit to 1 when it does not see a clock edge on the incoming lines in the window where it expects one. this bit is latched until reset by a reset missing clock or enter search mode command in wr14. in the nrzi mode of operation and while the dpll is disabled, this bit is always 0. bit 6: two clocks missing while operating in the fm mode, the dpll sets this bit to 1 when it does not see a clock edge in two successive tries. at the same time the dpll enters the search mode. this bit is latched until reset by a reset missing clock or enter search mode command in wr14. in the nrzi mode of operation and while the dpll is disabled, this bit is always 0. bit 4: loop sending this bit is set to 1 in sdlc loop mode while the transmitter is in control of the loop, that is, while the scc is actively transmitting on the loop. this bit is reset at all other times. this bit can be polled in sdlc mode to determine when the closing flag has been sent. bit 1: on loop this bit is set to 1 while the scc is actually on-loop in sdlc loop mode. this bit is set to 1 in the x21 mode (loop mode selected while in monosync) when the transmitter goes active. this bit is 0 at all other times. this bit can also be polled in sdlc mode to determine when the closing flag has been sent.
register description amd 6C38 6.3.9 read register 12 rr12 returns the value stored in wr12, the lower byte of the time constant for the baud rate generator. figure 6C25 shows the bit positions for rr12. d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 tc 3 tc 4 tc 5 tc 6 tc 0 tc 1 tc 2 tc 7 lower byte of time constant figure 6C25. read register 12 6.3.10 read register 13 rr13 returns the value stored in wr13, the upper byte of the time constant for the baud rate generator. figure 6C26 shows the bit positions for rr13. d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 tc 11 tc 12 tc 13 tc 14 tc 8 tc 9 tc 10 tc 15 upper byte of time constant figure 6C26. read register 13
register description amd 6C39 6.3.11 read register 15 rr15 reflects the value stored in wr15, the external/status ie bits. the unused bit is always returned as 0 unless the corresponding bits in wr15 have been set to 1. in the nmos scc, bits d 0 and d 2 always read 0. figure 6C27 shows the bit positions for rr15. d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 dcd ie sync/hunt ie cts ie tx underrun/eom ie sdlc/hdlc enhancement status zero count ie 10 x 19-bit frame status fifo enable status break/abort ie figure 6C27. read register 15
7C1 chapter 7 scc application notes 7.1 am8530h initialization 7C3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.1.1 introduction 7C3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.1.1.1 register overview 7C3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.1.1.2 initialization procedure 7C4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.1.1.3 initialization table generation 7C6 . . . . . . . . . . . . . . . . . . . . . . . . 7.1.1.4 reset conditions 7C6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.2 polled asynchronous mode 7C7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.2.1 introduction 7C7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.2.2 scc interface 7C8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.2.3 scc initialization 7C8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.2.3.1 scc operating mode programming 7C9 . . . . . . . . . . . . . . . . . . . 7.2.3.2 scc operating mode enables 7C10 . . . . . . . . . . . . . . . . . . . . . . . 7.2.4 transmit and receive routines 7C10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.3 interrupt without intack asynchronous mode 7C11 . . . . . . . . . . . . . . . . . . . . . . . . . 7.3.1 introduction 7C11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.3.2 scc interface 7C11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.3.3 scc initialization 7C11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.3.3.1 scc operating modes programming 7C12 . . . . . . . . . . . . . . . . . . 7.3.3.2 scc operating mode enables 7C13 . . . . . . . . . . . . . . . . . . . . . . . 7.3.3.3 scc operating mode interrupts 7C13 . . . . . . . . . . . . . . . . . . . . . . 7.3.4 interrupt routine 7C14 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.4 interfacing to the 8086/80186 7C15 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.4.1 8086 (also called iapx86) overview 7C15 . . . . . . . . . . . . . . . . . . . . . . . . . 7.4.1.1 the 8086 and am8530h interface 7C15 . . . . . . . . . . . . . . . . . . . . 7.4.1.2 initialization routines 7C18 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.5 interfacing to the 68000 7C20 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.5.1 68000 overview 7C20 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.5.2 the 68000 and am8530h without interrupts 7C21 . . . . . . . . . . . . . . . . . . . 7.5.3 the 68000 and am8530h with interrupts 7C23 . . . . . . . . . . . . . . . . . . . . . . 7.5.4 the 68000 and am8530h with interrupts via a pal device 7C25 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.6 am7960 and am8530h application 7C26 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.6.1 distributed data processing overview 7C26 . . . . . . . . . . . . . . . . . . . . . . . . 7.6.2 data communications at the physical layer 7C27 . . . . . . . . . . . . . . . . . . . . 7.6.3 hardware considerations 7C28 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.6.4 software considerations 7C32 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
scc application notes amd 7C2
7C3 scc application notes chapter 7 7.1 am8530h initialization 7.1.1 introduction this application note describes the software initialization procedure for the am8530 serial communications controller (scc). table 7C1 provides a worksheet that can be used as an aid when initializing the scc. since all scc operation modes are initialized in a similar manner, the worksheet can be used to tailor the scc device to the users individual need. specific examples are given in the following chapters. 7.1.1.1 register overview each of the sccs two channels has its own separate write registers that are pro- grammed to initialize different operating modes. there are two types of bits in the write registers: command bits and mode bits. an example of a register that contains both types of bits is write register 9 (wr9), and is shown in figure 7C1. wr9 is the master interrupt control register and contains the reset command bits. com- mand bits are denoted by having boxes drawn around them in register diagrams. bit d5 in this register is not used in this register and must be 0 at all times. d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 00 01 10 11 no reset channel reset b channel reset a force hardware reset vis nv dlc 0 mie status high/ status low figure 7C1. write register 9 the command bits, d7 and d6, select one of the reset commands for the scc. setting either of these bits to 1 disables both the receiver and the transmitter in the correspond- ing channel, forces txd for the channel marking, forces the modem control signals high in that channel, resets all ips and iuss, and disables all interrupts in that channel. func- tions controlled by the command bits can be enabled or disabled only; they cannot be toggled.
scc application notes amd 7C4 bits d4Cd0 are mode bits that can be enabled or disabled either by being set to 1 or re- set to 0. each mode bit affects only one function. for example, bit d1 is the no vector mode bit; it controls whether or not the scc will respond to an interrupt acknowledge cy- cle by placing a vector on the data bus. if this bit is set, no vector is returned. in com- mand bits entry, each new command requires a separate rewrite of the entire register. care must be taken when issuing a command so that the mode bits are not changed acci- dentally. 7.1.1.2 initialization procedure the scc initialization procedure is divided into three parts. the first part consists of pro- gramming the operation modes (e.g., bits-per-character, parity) and loading the constants (e.g., interrupt vector, time constants). the second part enables the hardware functions (e.g., transmitter, receiver, baud-rate generator). it is important that the operating modes are programmed before the hardware functions are enabled. the third part, if required, consists of enabling the different interrupts. table 7C2 shows the order (from top to bottom) in which the scc registers are to be pro- grammed. those registers that need not be programmed are listed as optional in the comments column. the bits in the registers that are marked with an x are to be pro- grammed by the user. the bits marked with an s are to be set to their previous pro- grammed value. for example, in part 2, write register 3, bits d1Cd7 are shown with an s because they have been programmed in part 1 and must remain set to the same value.
scc application notes amd 7C5 table 7C1. scc initialization worksheet 1 1 0 00000 7 6 5 43210 0 c wr9 register hex binary comments software reset modes 00 0000 0 wr0 wr4 00000 wr1 wr2 0 wr3 0 wr5 wr6 wr7 00 0 0 wr9 wr10 wr11 wr12 wr13 0 wr14 0 wr14 wr14 wr3 wr5 0 wr0 wr1 wr15 wr0 wr0 wr1 wr9 enables interrupt 0 8 0 1 0 1 00 0 1 1 1 10 00001 0 00 01000 reset txcrc reset ext/status reset ext/status 0 00 01000 00 0
scc application notes amd 7C6 table 7C2. scc initialization order part 1. modes and constants wr9 1100000 hardware reset wr4 xxxxxxxx tx/rx con, aysnc or sync mode wr1 0xx00x00 select w/req (opt) wr2 xxxxxxxx program interrupt vector (opt) wr3 xxxxxxx0 select rx control wr5 xxxx0xxx select tx control wr6 xxxxxxxx program sync character (opt) wr7 xxxxxxxx program sync character (opt) wr9 000x0xxx select interrupt control wr10 xxxxxxxx miscellaneous control (opt) wr11 xxxxxxxx clock control wr12 xxxxxxxx time constant lower byte (opt) wr13 xxxxxxxx time constant upper byte (opt) wr14 xxxxxxx0 miscellaneous control wr14 xxxssssscommands (opt) part 2. enables wr14 000ssss1 baud rate enable wr3 sssssss1 rx enable wr5 ssss1sss tx enable wr0 10000000 reset tx crg (opt) wr1 xss00s00 dma enable (opt) part 3. interrupt status wr15 xxxxxxxx enable external/status wr0 00010000 reset external status wr0 00010000 reset external status twice wr1 sssxxsxx enable rx, tx and ext/status wr9 000sxsss enable master interrupt enable 1 = set to one x = user defined 0 = reset to zero s = same as previously prog. 7.1.1.3 initialization table generation table 7C1 as shown previously, is a worksheet for the initialization of the scc. all the bits that must be programmed as either a 0 or a 1 are already filled in; the remaining bits are left blank and are to be programmed by the user according to the desired mode of operation. the binary value can then be converted to a hexadecimal number and placed in the table, following the write register notation in the column labeled hex. a program initialization table is produced when this worksheet is completed. 7.1.1.4 reset conditions prior to initialization, the scc should be reset by either hardware or software. a hardware reset can be accomplished by simultaneously grounding rd and wr. a software reset can be executed by writing a c0h to write register 9. after one channel has been initial- ized, a channel reset should be used in place of the hardware reset in the initialization. the state of the scc registers, after reset, is shown in table 7C3. before writing to the scc, a read should be performed to guarantee the internal logic is pointing to register 0.
scc application notes amd 7C7 7.2 polled asynchronous mode 7.2.1 introduction this section describes the use of the scc in polled asynchronous mode. the device can be set with 5 to 8 bits per character, 1, 1- 1 / 2 , or 2 stop bits, and a wide range of baud rates. in this particular example, 8 bits per character, 2 stop bits and 9600 baud rate are used. an external 2.4576 mhz, crystal oscillator is used for baud-rate generation. the scc can be programmed for local loopback for on-board diagnostics. the user can make use of this feature to test-program the part without additional hardware to simulate an ac- tual transmit and receive environment. table 7C3. scc register reset values 0 0 0 00000 7 6 5 43210 wr0 register hardware reset 00 00 wr1 wr2 0 wr3 wr4 0 wr5 wr6 wr7 11 0 0 wr9 wr10 wr11 wr12 wr13 0 wr14 0 wr15 rr0 rr1 rr3 0 rr10 01 0 0 00 00000 0 0 0 00000 7 6 5 43210 channel reset 00 00 00 0 0 0 0 01 0 0 0 00 00000 00 1 0000 00 0000 0 0 00 0 0 001000 10000 10 11 11100 01 00011 0 0 000000 0 00 00 00 0 00 00 11 10 1 11 11 00 0 10 0 0 0 00 00 0 0000 1
scc application notes amd 7C8 7.2.2 scc interface figure 7C2 shows the scc to cpu interface required for this application. the 8-bit data bus and control lines all come from the users cpu. the am8530 control lines are rd , wr , a/ b , d/ c and ce . pclk comes from the system clock, or an external crystal, up to the maximum rate of the scc. the iei and the intack pins should be pulled up. the baud-rate generator clock is connected to the rtxc pin. 7.2.3 scc initialization initialization of the scc for polled asynchronous communication is divided into two parts; part one programs the operating modes of the scc and part two enables them (refer to table 7C4). care must be taken when writing the software to meet the sccs cycle and reset recovery times. the cycle recovery time, 6 pclk cycles, applies to the period between any read or write cycles affecting the scc. the reset recovery time is the period after a hardware reset caused either by hardware or software; this recovery time extends the cycle recovery time to 11 pclk cycles. data 8 control 5 system v cc v cc xtal osc 2.4576 mhz osc pclk rtxc intack iei d0 C d7 scc pin 12 for channel a pin 28 for channel b figure 7C2. scc interface
scc application notes amd 7C9 table 7C4. polled asynchronous initialization procedure register value comments wr9 c0h force hardware reset wr4 4ch x16 clock, 2 stop bits, no parity wr3 c0h rx 8 bits, rx disabled wr5 60h tx 8 bits, dtr, rts, tx off wr9 00h int. disabled wr10 00h nrz wr11 56h tx & rx = brg out, trxc = brg out wr12 06h time constant = 6 wr13 00h time constant high = 0 wr14 10h brg in = rtxc , brg off, loopback enables wr14 11h brg enable wr3 c1h rx enable wr5 68h tx enable 7.2.3.1 scc operating mode programming wr9 resets the scc to a known state by writing a c0 hex. the force hardware reset command is identical to a hardware reset. it will reset both channels. wr4 selects the asynchronous, x 16 mode, with 2 stop bits and no parity. the x 16 mode means that clock rate is 16 times the data rate. wr3 selects 8 bits per character and does not enable the receive. the 8 bits per charac- ter allows 8 bits to be assembled from the data stream. the receiver is not enabled at this time because the scc has not been initialized. wr5 selects 8 bits per character and does not enable the transmitter. the 8 bits per char- acter allows 8 bits to be sent, as data, with the least significant bit first. the transmitter is not enabled at this time because the scc has not been initialized. wr9 selects that there are no interrupts enabled. this inhibits the scc from requesting an interrupt from the cpu. wr10 selects nrz encoding. this nrz coding is used on the transmitter as well as the receiver. wr11 selects the rtxc pin to ttl clock; the baud-rate generator is the transmit and re- ceive clocks source, and the trxc pin is used as a baud-rate generator output. wr12 & wr13 select the baud-rate generators time constant. the wr13 time constant is determined by the equation: time constant = clock frequency 2 x baud rate x clock mode C2 in this example, the clock frequency is 2.4576 mhz, the baud rate is 9600, the clock mode is 16. the time constant is, therefore, 6; expressed as a 16-bit, hexadecimal num- ber, it is 0006h. the time constant low (wr12) is, therefore 06h and the time constant high (wr13) is 00h. the baud rate for this example can be varied, as long as the data rate is less than 1 / 4 of the pclk rate. table 7C5 shows the time constants for other com- mon baud rates.
scc application notes amd 7C10 table 7C5. time constants for common baud rates baud divider rate dec hex 38400 0 0000h 19200 2 0002h 9600 6 0006h 4800 14 000eh 2400 30 001eh 1200 62 003eh 600 126 007eh 300 254 00feh 150 510 01feh for 2.4576 mhz clock, x16 clock mode wr14 selects the baud-rate generator as the rtxc pin, baud-rate generator disabled, and internal loopback. the baud-rate generator uses the rtxc pin as the clock source and is not enabled at this time because the scc initialization is not complete. 7.2.3.2 scc operating mode enables wr14 enables the baud-rate generator. bit 0 (lsb) is changed to a 1 to enable the baud-rate generator; all other bits must maintain the value selected during initialization. wr3 enables the receiver. bit 0 (lsb) is changed to a 1 to enable the receiver; all other bits must maintain the value selected during initialization. wr5 enables the transmitter. bit 3 is changed to a 1 to enable the transmitter; all other bits must maintain the value selected during initialization. 7.2.4 transmit and receive routines after initialization, and after all enables have been selected, the scc is ready for commu- nication. the transmitter buffer and the receive fifo are empty. the example shown be- low is coded to transmit and receive characters. ;transmit a character txchar:input rro ;read rro test bit2 ;test transmit buffer empty jz txchar;loop if not empty output char ;output character to data port ret ;return ;receive a character rxchar:input rro ;read rro test bit 0 ;test receive buffer jz rxchar;loop if not full input char ;input character from data port ret ;return figure 7C3. transmit and receive routine
scc application notes amd 7C11 7.3 interrupt without intack asynchronous mode 7.3.1 introduction this section describes the use of the scc for interrupt-driven asynchronous mode. as with the example in the previous chapter, the scc is set with 8 bits per character, 2 stop bits, at 9600 baud rate. an external 2.4576 mhz, crystal oscillator is used for baud-rate generation. interrupt acknowledge is not generated because of the extra hardware re- quired to produce this signal. in this chapter, the scc is also programmed for local loop- back so that no external loop between the transmit and the receive data lines is needed for on-board diagnostics. this feature allows the user to test-program the part without additional hardware to simulate an actual transmit and receive environment. 7.3.2 scc interface figure 7C4 shows the scc to cpu interface required for this application. the 8-bit data bus and control lines all come from the users cpu. the control lines are rd , wr , a/ b , d/ c and ce . the int signal goes to an interrupt controller which must produce the inter- rupt vector to the cpu. the pclk comes from the system clock, or an external crystal oscillator, up to the maximum rate of the scc (e.g., 6 mhz for the am8530a). the iei and the intack pins should be pulled up. the baud-rate generator clock is connected to the rtxc pin. 7.3.3 scc initialization the initialization of the scc for interrupt-driven asynchronous communication is divided into three parts as shown in table 7C6. part one programs the operating modes of the scc, part two and three enable them. care must be taken when writing the code to meet the sccs cycle and reset recovery times. the cycle recovery time applies to the pe- riod between any read or write cycles to the scc, and is 6 pclk cycles. the reset re- covery time applies to a hardware reset caused either by hardware or software; this recovery time extends the cycle recovery time to 11 pclk cycles. data 8 control 5 system v cc v cc xtal osc 2.4576 mhz osc pclk rtxc intack iei d0 C d7 scc pin 12 for channel a pin 28 for channel b interrupt controller int figure 7C4. scc interface
scc application notes amd 7C12 table 7C6. scc initialization order for interrupt driven asynchronous mode register value comments wr9 c0h force hardware reset wr4 4ch x 16 clock, 2 stop bits, no parity wr2 00h interrupt vector 00 wr3 c0h rx 8 bits, rx disabled wr5 60h tx 8 bits, dtr, rts, tx off wr9 00h int disabled wr10 00h nrz wr11 56h tx & rx = brg out, trxc = brg out wr12 06h time constant = 6 wr13 00h time constant high = 0 wr14 10h brg in = rtxc, brg of, loopback enables wr14 11h brg enable wr3 c1h rx enable wr5 68h tx enable enable interrupts wr1 12h rx int on all char and tx int enables wr9 08h mie 7.3.3.1 scc operating modes programming wr9 resets scc to a known state by writing a c0 hex. this command, force hardware reset, is identical to a hardware reset. it will reset both channels. wr4 selects asynchronous mode, x16 mode, 2 stop bits and no parity. the x16 mode means that the clock rate is 16 times the data rate. wr2 is the interrupt vector of the scc. even though a vector is not placed in the bus in this mode the vector including status is read from rr2. by writing 00h to this register the status read will be the only bits set in rr2. wr3 selects 8 bits per character and does not enable the receiver. the 8 bits per charac- ter allows 8 bits to be assembled from the data stream. the receiver is not enabled at this time because the scc is not completely initialized. wr5 selects 8 bits per character and does not enable the transmitter. the 8 bits per char- acter allows 8 bits to be sent as data with the least significant bit first. the transmitter is not enabled at this time because the scc is not completely initialized. wr9 selects that there are no interrupts enabled. this will inhibit the scc from request- ing an interrupt from the cpu. wr10 selects nrz encoding. this selects nrz coding that is to be used on the transmit- ter and the receiver. wr11 selects the rtxc pin to ttl clock, the transmit and receive clocks source as the baud-rate generator and the trxc pin as a baud-rate generator output.
scc application notes amd 7C13 wr12 & wr13 select the baud-rate generator time constant. the time constant is deter- mined by the equation: time constant = clock frequency 2 x baud rate x clock mode C2 in this example, the clock frequency is 2.4576 mhz, the baud rate is 9600, and the clock mode is 16; the time constant is 6. converting this time constant to a 16-bit hexadecimal number, it becomes 0006h. the time constant low (wr12) is 06h and the time constant high (wr13) is 00h. the baud rate for this example can be varied for as long as the data rate is less than 1 / 4 of the pclk rate. table 7C7 gives the time constants for other com- mon baud rates. table 7C7. time constants for common baud rates baud divider rate dec hex 38400 0 0000h 19200 2 0002h 9600 6 0006h 4800 14 000eh 2400 30 001eh 1200 62 003eh 600 126 007eh 300 254 00feh 150 510 01feh for 2.4576 mhz clock, x16 clock mode wr14 selects the baud rate source as the rtxc pin, baud rate generator disabled, and internal loopback. the baud-rate generator will use the rtxc pin as the clock source for the baud-rate generator. the baud-rate generator is not enabled at this time because the scc initialization is not complete. 7.3.3.2 scc operating mode enables wr14 enables the baud-rate generator. bit 0 (lsb) is changed to a 1 to enable the baud- rate generator; all other bits must maintain the value selected during initialization. wr3 enables the receiver. bit 0 (lsb) is changed to a 1 to enable the receiver; all other bits must maintain the value selected during initialization. wr5 enables the transmitter. bit 3 is changed to a 1 to enable the transmitter; all other bits must maintain the value selected during initialization. 7.3.3.3 scc operating mode interrupts wr1 enables the tx and the rx interrupts. the rx interrupt is programmed to generate an interrupt on all received characters or special conditions. this provides an interrupt on every character received by the scc. the external/status interrupts are not enabled in this application. wr9 sets the master interrupt enable (mie) bit 3. setting this bit enables the interrupts pending to generate and interrupt on the int pin.
scc application notes amd 7C14 7.3.4 interrupt routine when the scc has been initialized and enabled, it is ready for communication. the trans- mitter buffer and the receive fifo are both empty. an interrupt will not be generated until the software writes the first character to the transmit buffer. once the first character is in the scc shift register, the first transmit interrupt will occur. the scc then continues to issue interrupts to the interrupt controller until the end of the message. at the end of the message, a reset transmitter interrupt pending (wr0) is issued to clear the transmit interrupt. after the last character is read into the scc, the interrupts will cease until an- other message is written into the transmitter. once an interrupt is received and the interrupt controller vectors to the interrupt routine, rr2 is read from channel b. the value read from rr2 is the vector, including status. this vector shows the status of the highest priority interrupt pending (ip) at the time it is read. once the highest priority interrupt condition is cleared, rr2 will show the status of the next highest interrupt pending, if one is present. this allows multiple interrupts to be serv- iced without the overhead of the interrupt acknowledge cycle of the interrupt controller. mie is disabled and then enabled to guarantee an edge for an edge-sensitive interrupt controller. the following example shows how the interrupt routine should be coded. begin: input rr2 ;read rr2 from channel b test bit 4 ;test for tx empty je txempty ;jump to transmit routine test bit 5 ;test for rx full jump rxfull ;jump to receive routine out wr9 00 ;mie disabled out eoi ;output eoi to interrupt controller iret ;return to main ; ; txempty: test nomore ;test a last character flag je last ;jump to last if no more characters output char ;output character to data port dec charcount ;decrement character count jump begin ;jump to begin to test for more ip ; last: output rr0,28h ;reset tx interrupt pending jump begin ;jump to begin to test for more ip ; ; rxfull: input rr1 ;read rr1 compare rr1,00 ;test for special condition bit set jump ne ;jump to special input char ;input charcater from data port jump begin ;jump to begin to test for more ip ; special; . . this means a framing error, receive overrun error or parity error has occurred. character may be read but data is not correct. a flag should be set to post the error. . . output rr0, 30h ;reset error command jump begin ;jump to begin to test for more ip figure 7C5. scc interrupt routine
scc application notes amd 7C15 7.4 interfacing to the 8086/80186 7.4.1 8086 (also called iapx 86) overview the 8086 is a general purpose 16-bit microprocessor cpu. the cpu has a 16 bit data bus multiplexed with sixteen address outputs. there are four additional address lines (segment addresses which are multiplexed with status) that increase the memory range to 1 mbyte. the 8086 addresses are specified as bytes. in a 16 bit word, the least significant byte has the higher address. this is compatible with 8080, 8085, z80 and pdp11 addressing schemes but differs from the z8000 and 68000 addressing. the data bus is asynchronous; i.e, the cpu machine cycle can be stretched without clock manipulation by inserting wait states between t2 and t3 of a read or write cycle to accommodate slower memory or peripherals. unlike the 68000, the 8086 has separate address spaces for i/o (64 kbytes). the 8086 can operate in min. or max. mode. maximum mode offloads certain bus con- trol functions to a peripheral device and allows the cpu to operate efficiently in a co-proc- essor environment. a brief discussion on both the min. and the max. modes follows. min. mode : i/o addressing is define by a high or the io/m output, and activated by the rd output for reading from memory, or i/o or activated by the wr output for writing to memory or i/o. dma : the bus is requested by activating the hold input to the 8086. bus grant is confirmed by the hlda output from the 8086. max. mode : i/o operation is controlled by two outputs from the 8288. (8086 plus iorc : active during read from i/o 8288) iowc : active during write to i/o mrdc : active during read from memory mwtc : active during write to memory dma : the bus is requested and bus grant is acknowledged on the same pin ( rq / gt0 or rq / gt1 ) through a pulsed handshake. interrupts in min. and max. modes: interrupt is requested by activating the intr or nmi inputs to the 8086. interrupt is acknowledged by the inta pin on a min. mode 8086 or by the inta pin on the 8288 in max. mode. note: there is no rd or iorc during the interrupt acknowledge sequence. 7.4.1.1 the 8086 and am8530h interface most common systems demultiplex address and data. the am8530h is compatible with these systems. interface between the 8086 and the am8530h peripheral device shows how to take ad- vantage of its interrupt structure as shown in figure 7C6. intack is generated by the 8086s first inta pulse. this allows about 800 nsec for the interrupt daisy chain to settle. the second inta pulse is then gated to the rd pin which places the vector on the bus. at 8 mhz, two wait states must be inserted. this design is the same when interfacing to the 186. it requires no additional wait states. diagrams in figure 7C7 show the connections for 74ls74 in both 5 mhz and 8 mhz operations of the 8086. figure 7C8 is an alternate implementation which can be used in place of the logic in the dotted area in figure 7C6. note that the falling edge of wr must be delayed to meet data setup time requirements. a wait state must be inserted (not shown) to meet pulse width requirements during a write.
scc application notes amd 7C16 the am29841 is a high speed 10-bit latch with high drive capability. other latches may be used instead. most designers latch bhe even though s 7 is the same, the few extra bits become quite useful when trying to keep parts count down. a 0 C a 9 a 8 C a 15 a 16 C a 19 m/ io ad 19 ad 10 ale ad 9 ad 0 intr reset inta rd wr clk cs d/ c d 7 d 0 int intack rd wr am8530h 8086 5 mhz am29841 le oe oe le am29806 74ls04 74ls04 reset from 8284a 74ls04 74ls02 74ls02 pre d cp q q 74ls74 d cp q q clr 74ls74 figure 7C6. 8086scc interface
scc application notes amd 7C17 t 1 t 2 t 3 t 4 t 1 t 1 t 1 t 2 t 3 t 4 125 ns 186 186 8 x 125 = 1000 ns 8 mhz 8086 6 x 200 = 1200 ns 5 mhz 8086 8 mhz = 325 inta inta 1 inta 2 pre d cp q q 74ls74 inta 1 inta reset pre d cp q q 74ls74 inta 2 inta reset 8 mhz 8086 figure a 5 mhz 8086 figure b figure 7C7. interrupt acknowledge timing inta reset intack rd d cp q 1 q 1 clr clr d cp q 2 pr inta q 1 q 2 = intack rd figure 7C8. interrupt acknowledge timing implementation
scc application notes amd 7-18 7.5.1.2 initialization routines the sample assembly initialization routine, figure 7-9 takes into account the read/ write recovery time and has been tested in an 8 mhz system. the interrupt service routines for channel b are for testing only and are not intended as realistic examples. also, figure 7- 10 shows a sample initialization sequence written in "c." amc amdos 8/8 64k, version 2.00 - 9/26/80 type int8530.a86 ; this routine written for the 8086 ; initializes the 8530 scc for asynchronous ; operation at 9600 baud. ; register usage ; ax input and output data ; bx counter ; dx address of port ; bp pointer to memory cmd equ 0f902h ;command/status port data equ 0f900h ;data port tab equ offset table et equ offset etb org 0100h start: mov dx,cmd ;get address of cmd port in al,dx ;read status to set state mov bx,et-tab ;get table length mov bp,tab ;point to table rpt: mov al,[bp] ;get data from table out dx,al ;output address of register inc bp ;increment table pointer mov al,[bp] ;get data out dx,al ;output data to register inc bp ;increment table pointer dec bx ;count-1 jz rpt ;repeat if not done ;program continues as desired table db 009h ;address wr9 db 0c0h ;reset command db 003h ;address wr3 db 041h ;# of bits etc. db 004h ;address wr4 db 04ch ;data db 005h ;address wr5 db 028h ;bits/char and txen db 00bh ;address wr11 db 056h ;select baud gen db 00ch ;address wr12 db 00ch ;upper tc db 00dh ;address wr13 db 000h ;lower tc db 00eh ;address wr14 db 007h ;set dtr and enable baud gen etb: end figure 7-9. scc initialization
scc application notes 7-19 amd /********************************************************************* /* initializing the z8530 asynchronuously /* (using pointer referring to memory map i/o device) /************************************************************************** #include "stdio.h" #define spaddress 0x22fs5 /* status port address */ #define dpaddress 0x22f87 /* dataport address */ #define rxbit 2 /* receive ready bit */ #define txbit 1 /* transmit ready bit */ #define tablesize 16 main () { unsigned char table[tablesize]; unsigned long *ptspa, *ptdpa; unsigned char value; int i; /* data table for initialization */ table[0]=0x9; /* address wr9 */ table[l]=0xc0; /* hardware reset scc */ table[2]=0x3; /* address wr3 */ table[3]=0x41; /* set # of bits etc. */ table[4]=0x4; /* address wr4 */ table[5]=0x4c; /* misc mode */ table[6]=0x5; /* address wr5 */ table[7]=0x28; /* bits/char and txen */ table[8]=0xb. /* address wrii */ table[9]=0x56; /* select baud generator */ table[l0]=0xc; /* address wr12 */ table[ll]=0xc; /* upper tc */ table[l2]=0xd; /* address wr13 */ table[13]=0; /* lower tc */ table[l4]=0xe; /* address wr14 */ table[l5]=0x7; /* set dtr/req enable baud generator */ /* output data from table to perfore initialization */ ptspa=spaddress; /* pointer to status port address */ ptdpa=dpaddress; /* pointer to data port address */ value=*ptspa; /* read status to set the set state machine */ for (i--0; i scc application notes amd 7C20 7.5 interfacing to the 68000 7.5.1 68000 overview the 68000 has an asynchronous, 16-bit, bidirectional, data bus. data types supported by the 68000 are: bit data, integer data of 8-, 16- or 32-bit addresses and binary coded deci- mal data. it can transfer and accept data in either words or bytes. the dtack input indi- cates the completion of a data transfer. when the processor recognizes dtack during a read cycle, the data is latched and the bus cycle terminates. when dtack is recognized during a write cycle, the bus cycle also terminates. an active transition of dtack indi- cates the termination of data transfer on the bus. all control and data lines are sampled during the 68000s clock high time. the clock is internally buffered, which results in some slight differences in the sampling and recognition of various signals. the 68000 mask sets prior to cc1 and allows dtack to be recognized as early as s2, and all devices allow berr or dtack to be recognized in s4, s6, etc., which terminates the cycle. if the re- quired setup time is met during s4, dtack will be recognized during s5 and s6, and data will be captured during s6. dtack signal is internally synchronized to allow for valid operation in an asynchronous system. if an asynchronous control signal does not meet the required setup time, it is possible that it may not be recognized during that cycle. be- cause of this, synchronous systems must not allow dtack to precede data by more than 40 to 240 nanoseconds, depending on the speed of the particular processor. i/o is mem- ory-mapped, i.e., there are no special i/o control signals. any peripheral is treated as a memory location. dma: this bus is requested by activating the br input of the 68000. bus arbitration is started by the bg output going active. the bus is available when as becomes inactive. the requesting device must acknowledge bus mastership by activating the bgack input to the cpu. the 23-bit address (a 1 ? a 23 ) is on an unidirectional, three-state bus and can address 8 mwords (16 mbytes) of memory or i/o. it provides the address for bus operation during all cycles, except the interrupt cycles. during interrupt cycles, address lines a1, a2 and a3 provide information about the level of interrupt being serviced. instead of a 0 and byte/ word , there are two separate data strobe lines for the two bytes in a word. a note of caution here, the 68000 treats the msb of the lower byte as an even byte, or word ad- dress. the same goes with processors such as the z8000. processors such as the 8086 treat the lower byte as the odd byte. interrupt is requested by activating any combination of the interrupt inputs to the 68000 (ipl0 ? 2), indicating the encoded priority level of the interrupt requester (inputs at or be- low the current processor priority are ignored). the 68000 automatically saves the status register, switches to supervisor mode, fetches a vector number from the interrupting de- vice, and displays the interrupt level on the address bus. for interfacing with old 68000 peripherals, the 68000 issues an enable signal at one-tenth of the processor clock fre- quency. there are a number of amd proprietary third generation peripherals that can be interfaced to the 68000 cpu, to improve system performance. this chapter deals mainly with the interfacing of the 68000 and the am8530h.
scc application notes amd 7C21 7.5.2 the 68000 and am8530h without interrupts implementation of an interface without interrupt is straightforward. intack must be tied high when not in use and the shift register provides a means for inserting wait states. figure 7C11 shows the interface between the 68000 and the am8530h. the am8530h scc. it supports all advanced protocols and has a number of user programmable fea- tures that provide design flexibility. q c q b a 23 wr rd a/ b d/ c cs am8530h clk clr b a q a q d 74ls04 c anye xack am29006 am29006 a 16 a 11 a 10 a 3 a 1 a 2 dtack lds r/ w 74ls74 cp d q clk 74ls32 74ls32 74ls164 74ls04 74ls32 68000 74ls04 figure 7C11. scc68000 interfacing
scc application notes amd 7C22 q c q b a 23 cs am8530h clk clr b a q d am29809 a 18 a 11 a 1 a 4 lds r/ w int rd d/ c 74ls74 cp d q clk 74ls32 74ls32 74ls04 74ls02 anye ack am29806 clk dtack 68000 74ls04 clk ei 0 1 2 3 4 a 0 a 1 a 2 a 1 a 2 a 3 a b c 1 2 3 4 inta a b c g2a a b clr clk 7 74ls138 q e q f oc 74ls16 clk inta wr 74ls138 pclk clk/2 123 74ls04 g a 7 a 0 clk e out clk/2 v cc g e out a 0 s 1 s 0 pre 8 6 a 5 a 10 a 3 ipl 0 ipl 1 ipl 2 fc 1 fc 2 fc 0 as other intrrupts inta for other interrupting devices 74ls164 bip switches or solder bridges for setting address 74ls04 connect for desired number of wait states 74ls164 74ls02 74ls04 74ls04 74ls148 a 5 osc figure 7C12. am8530h to 68000 connection with interrupts using ssi and msi the data bus between the 68000 and the am8530h are directly linked together. the am29806 decodes the address and generates cs for the peripheral and produces anye , which is used by the 74ls164, to generate wait states. the 74ls164 controls the num- ber of wait states by the c input which in turn controls the dtack signal to the cpu. this allows rd and wr to obtain the required 400 ns width. a 1 generates the c/ d input to the am8530h while the remaining address lines are connected to the am29809 ad- dress comparator. the am29809 comparator and the am29806 comparator/decoder provides high-speed address selection as well as an open collector acknowledge driver. this allows memories and peripherals to be conveniently wire-ored to the processors dtack pin. this inter- face does not provide a hardware reset; therefore, it is necessary to do a dummy read to the control port before issuing a software reset.
scc application notes amd 7C23 7.5.3 the 68000 and am8530h with interrupts the following description addresses the problems of interfacing the 68000 and am8530h with interrupts. the circuit configuration is basically the same as the design without inter- rupts. the 74ls148 and the two 74ls138s assume there are other interrupting devices which are not compatible with the interrupt daisy chain of the am8530h. the 74ls148 and one of the 74ls138 can be eliminated if this is not the case. the first 74ls138 acts as a status decoder; it is gated with as to de-glitch the outputs. the second 74ls138 decodes the interrupt acknowledge priority level, allowing a two- dimensional priority scheme. daisy chain can be used to resolve priority at any given pri- ority level while the cpu resolves priority between levels. the 74ls164 is added to generate the correct timing during an interrupt acknowledge cycle. it allows 5 cpu clocks for the daisy chain to settle before it generates rd to put the vector onto the bus. the daisy chain is implemented by using the iei, ieo pins (not shown in figure 7C12) on the 8500 peripherals. the time allowed for the daisy chain to settle is a function of the number of devices in the chain; thus the allowance of 5 clocks used here is arbitrary. the 74ls164 also generates dtack . a block diagram of this inter- face is shown in figure 7C15. timing diagram is followed in figure 7C13. it is more straightforward to use the am9519a interrupt controller instead of the on-chip interrupt features. however, this approach does not allow the programmer to take advantage of some of the am8530h time-saving features. s 0 s 1 s 2 s 3 s 4 s w s w s w s w s w s w s w s w s w s w s 6 s 7 s 0 s w t 1 t 2 t w t w t w t w t w t 3 t 4 as fc0?c02 iack dtack rd data in a 1 - a 3 read data figure 7C13. am8530h to 68000 interrupt acknowledge timing
scc application notes amd 7C24 8 1 fc fc 2 a 23 ce am8530h am29809 a 1 a 4 int rd anye c dtack 74ls04 ack wr g e out g e o a 7 a 0 ? ? ? a 5 a 0 ? ? ? s 1 s 0 8 a 5 ? ? ? a 10 a 3 ipl 2 ipl 1 ipl 0 v cc a 11 ? ? ? a 18 osc ack rd clock fc 1 fc 0 fc 2 lds rw as clock fc 0 lds r/ w as d 7 d 0 ? ? ? v cc inta d 7 d 0 ? ? ? d/c 8 68000 am29809 ampal 16r4 68k85xx wr wo oe inta v cc v cc figure 7C14. 68000 to am8530 connection using a pal
scc application notes amd 7C25 as ds rd dtack a b c pal outputs: figure 7C15. pal timing 7.5.4 the 68000 and am8530h with interrupts via a pal device this example shows how a programmable array logic (pal) device simplifies the task of interrupt generation compared to the msi implementation. the block diagram for the in- terface via a pal device is shown in figure 7C14. the timing diagram (figure 7C15) illus- trates the interrupt acknowledge cycle. as in the other designs, rd is generated during interrupt acknowledge to place the vector on the bus. the timing during register programming is not shown. the pal device allows selection of one or two wait states by making w0 high or low respectively. the table below shows the appropriate number of wait sates as a function of cpu speed. cpu speed wait states 4 mhz 1 6 mhz 2 8 mhz 2 10 mhz 2 pal device equations are shown in figure 7C16.
scc application notes amd 7C26 pa16r4 pal design spec pat 002 joe brich 9 sept 83 68000 to 8500 or 9500 peripherals advanced micro devices clock /cs rw /lds /wo /as fco fc1 fc2 gnd /oe /inta /ack /c /b /a /dlds /rd /wr vcc a := a*/b + b *c + /as b := a*/c + /a*c + /as c := /a*/b*as + b*c*as dlds := lds rd = lds*dlds*rw*/inta + /inta*/a*/b*c*wo + inta*/b*a + ack * lds description this pal device interfacesn 85xx type peripherals to the 68000 micro processor. it inserts 1 or 2 wait states as selected by /wo = 0 is one and /wo = 1 is two wait states. four wait states are inserted during the interrupt acknowledge cycles. also the rd output generated during inta is a function of the internal state machine and not a function of lds. oe can be left open since the flipCflop outputs are not used directly. the falling edge of rd is delayed in order to guarantee the cs to rd setup time requirements. figure 7C16. pal equations 7.6 am7960 and am8530h application 7.6.1 distributed data processing overview the changing data-processing environment has created attractive opportunities for dis- tributed processing, encouraging both users and vendors to support the concept. distrib- uted processing provides either functional or geographical dispersion while integrating the dispersed parts into a coherent system. the main advantages of distributed processing power are: a. efficiency specialized machines perform their functions in an efficient manner. large, centralized systems are often multi-tasked and they do not necessarily perform all the functions with equal efficiency. b. low cost i. a less complex computer, or other forms of distributed intelligence, is required. ii. it simplifies certain applications where only data accessing is required. c. control users have control of most of the computing power in the system organization. d. unlimited access distributed processing power allows the user greater access to the machine operating system and hardware. in large, centralized systems, very few users are allowed to access the mainframes operating system and hence cannot take full advantage of all the computers power. e. response time local processing eliminates the relatively slow common-carrier lines in favor of high- speed channels. distributed processing can improve response time for certain applications that can be partitioned for simultaneous execution in parallel on multiple,
scc application notes amd 7C27 functionally distributed computers. lengthy delays are often encountered in a centralized system due to overloaded cpus and slow communication lines. f. resource sharing remote sites in a distributed system can use each others facilities such as sharing expensive peripheral devices in the system. the advantages of distributed processing, therefore, point mainly to two important facts: 1. lans make distributed intelligence practical. 2. methods must be devised in order to allow large amount of data to be transported, at high speeds, between centers of intelligence. this discussion addresses the second factor. 7.6.2 data communications at the physical layer todays data communications market can be segmented in terms of speed. i. low speed (300 baudC56 kbaud) ii. medium speed (0.5 mb/sC3 mb/s) iii. high speed (10 mb/sC60 mb/s) iv. very high speed (100 mb/s and up) on medium speed applications data rate is assumed at 1 mb/s. at this rate, the physical interface requires a highly sophisticated transceiver. the following is a list of the require- ments: a. the transceivers must have good but inexpensive isolation from the cabling system (large common-mode voltages and surge voltages are common phenomenons in any network). pulse transformers can provide the required isolation. b. the transceiver must be able to support a good collision avoidance scheme, since all devices have equal access to the network (in a csma type architecture). if a collision does occur, the transceiver must detect the collision and flag the communications controller. c. the receiver must be able to inhibit false starts due to noise in the surrounding environment. d. the transmitter must control the slew rate of the output signal to reduce emi/rfi to surrounding electronic equipment. this is a very important criterion if the network is to meet fcc/vde regulations on radiation. e. if an isolation transformer is used, some form of data encoding must also be implemented so that a series of 1s or 0s do not saturate the transformer by charging it to either voltage level. why the am7960 the am7960 coded data transceiver is designated to meet all the requirements of the medium-speed network. it is frequency agile for data rates between 0.5 mb/s to 3 mb/s. electroCmagnetic interference the am7960 has an external resistor connected from the slew rate control pin (tsrc) to ground to control the transmit slew rate. if the rise and fall times of the output signal are each 30% of the transmit clock period, the output waveform looks approximately like a sine wave (figure 7C17). this has a smoothing effect on the transmitted signal, reducing 3rd, 5th and higher order harmonics. this in turn reduces energy radiating from the cable and minimizes the effects of electro-magnetic interference and radio frequency inter- ference.
scc application notes amd 7C28 t x c 30% txc 30% txc figure 7C17. slew rate controlled outputs common-mode problem the common-mode voltage problem can be resolved by using transformer isolation at the transceiver-cable interface. the am7960 provides a high impedance interface to the cou- pling transformer. it also implements a user-transparent manchester encoding/decoding scheme that limits the frequency of output data signals to within a narrow range. noise immunity in the receiver section of the am7960 a signal qualifier minimizes false starts, thus im- proving reliability. line activity is detected when the input signal crosses the threshold. the receive clock is acquired when there are two transitions of the input signal during a bit time interval. digital sampling the internal dpll runs at 16 times the data rate. hence, each bit of the received signal is quantized into 16 samples. the dpll is free-running when the line is quiet but synchro- nizes within 1/16 of a bit on the first valid signal edge. it then opens up a series of win- dows at the 5/16 to 7/16, 12, and 9/16 to 11/16 positions of the expected bit cell. zero-crossings within these windows set a shorten, center, or lengthen flag that makes the loop adjust for sampling of the next bit cell. the internal circuitry samples the incom- ing data at 1/4 and 3/4 bit intervals. a transition of voltage levels between these two time slots indicates the arrival of a valid manchester data bit. 7.6.3 hardware considerations the am7960 can be used with a am8530h serial communications controller (scc) to build a simple and cost-effective 1 mb/s data link for office and industrial applications. the am8530h is a two channel, software-programmable, device which can adapt to most system architectures including: n bus architectures (full-duplex and half-duplex) n token passing ring (sdlc loop mode) n star configurations (similar to slan) the power and flexibility of the am8530h, along with the am7960s csma-ca access scheme. manchester coding of data and output slew rate control enable the system de- signer to deliver an inexpensive 1 mb/s lan. the straightforward nature of the hardware connections is shown in figure 7C18. the request to send ( rts ) output from the scc is ored with inverted advance carrier de- tect ( acd ) output to implement the collision avoidance scheme.
scc application notes amd 7C29 acd is asserted whenever the receiver detects line activity. this scheme is a significant asset in the single bus (half-duplex) architecture shown in figure 7C19. consider the case where device 1 is transmitting and device 4 is receiving. although the message on the bus is not read by devices 2 and 3, their respective acd lines will be active (low) due to line activity at their receive inputs, rxl0 and rxl1. this prevents the controllers from transmitting as long as there is line activity, thus avoiding any potential collisions or inter- ruption of the transmission. during transmission, acd is internally negated. the acd and rts gating scheme does not interfere with normal data transmission. in this example (figure 7C19), the am7960 will generate and recognize its own preamble because the am8530h does not have that capability. this is called mode 0 operation and is accomplished by holding the mode pin low. the master reset input is an asynchro- nous transceiver reset. when asserted, all interface signals will be inhibited with the ex- ception of transmit clock. it has an internal pull-up resistor, internal discharge clamp diode, and input hysteresis to provide power-on reset with a single external capacitor to ground. the clear-to-send ( cts ) is activated just before the am7960 is ready to transmit data. the interface for transmit data (txd), transmit clock (txc), receive data (rxd), and carrier sense ( cs ) between the am7960 and the am8530h are direct connections. this ease of connection is possible because the am8530 supports the modem-like interface (standard for most usarts and serial communications controllers) for which the am7960 is designed. the rxc rising edge to rxd valid time on the am7960 varies from C5 ns to +20ns. the am8530h clocks in data on the rising edge of rxc and requires a set-up of at least 0 ns from rxd to the rising edge of rxc . this set-up time will not be met if the same rxc edge that clocks out data from the am7960 is used to clock in data to the am8530h. this problem can be solved by inverting the receive clock from the am7960 before feeding it into the am8530h. the x1 and x2 pins supply the clock to the digital phase-locked loop in the am7960, which in turn generates the txc and rxc signals. these inputs can be driven by either a crystal or a ttl source. the crystal oscillator circuit must be used, in 3rd harmonic, for frequencies above 24 mhz. if a ttl source is connected to x1, the x2 pin must be left open. the hardware connections between the am8530h and a cpu and dma controller are equally simple. use of a dma controller is suggested for any system that transmits above 500 kb/s, to simplify data transfers between the memory and the am8530h. after initializ- ing the am8530h and the dma channel, the cpu leaves the actual transfer of data to the dma controller (explained under software considerations later in this application note). during transmission, the scc requests a dma transfer by pulling the w / req line active (low) if the transmit buffer is empty, or keeps it high until the transmit buffer is empty. similarly, the receive section will request a dma transfer if the receive buffer contains a character or will keep w / req high until a character enters the receive buffer. a flag within the scc can be read to recognize an end-of-message (eom).
scc application notes amd 7C30 2.0 ior 2 a/ b gnd 5 9 9 20 19 21 23 22 17 2947 am8530h 7960 29809 18 15 16 10 12 14 11 2 24 3 rts txd txc cts acb cd cs rxc hrst test mode 13 rxd tv cc tv cc1 tv cc2 x1 x2 txl0 txl1 rxl0 4 1 rxl1 tsrc 22? 6 56 pf 56 pf 75 w pe5156x 3.3 k w 7 16 23 17 18 19 24 20 22 15 12 21 14 13 b7 b0 b6 b5 b4 b3 b1 gnd b2 11 1 ack g ad3 ? ad11 c e out a1-a0 b1-b0 d0-d7 1- 8 v cc +5 v 12-19 +5 v 1k w 11 i/r 5 10 32 36 35 20 34 33 31 +5 v int w / reqa d/ c wr pclk ce txda trxca txdb ctsa dcda rtxca rxda intack 101 ctsb dcdb rxdb 15 14 25 18 19 12 13 8 7 9 22 21 17 rt sa v cc +5 v 3 1 2 26ls32 26ls29 15 100 w 2 ?10 a0 ?a8 int drq1 ad0 pr d q plck ad1 dack1 .01 ? v cc acm 12 4 rd cd d0-d7 9 iow figure 7C18. 7960-am8530h hardware interface diagram
scc application notes amd 7C31 am8530h scc am7960 cdt memory cpu am9517 dma device 2 device 3 device 4 7511 coax device 1 figure 7C19. bus architecture central controller device 2 device 3 device 4 1 mbps data link device 1 device 4 device 2 device 3 1 mbps data link device 1 figure 7C20. star network and token passing ring (sdlc loop mode)
scc application notes amd 7C32 the am8530h can also be configured to make the entire system interrupt-driven. the chip can be set up to interrupt the cpu on external conditions (i.e., a change on a modem line or a break condition). it can also be set up to cause receive interrupt on first charac- ter, on all characters, or on one of many special receive conditions (e.g., receiver overrun, framing error, or end of frame). the am7960 can also support a full-duplex operation (point-to-point between two de- vices). in this case, no collision avoidance scheme needs to be implemented because only one device can talk on one line at a time. such a set-up would be very practical for star configurations, or token passing ring, or loop configurations (shown in figure 7C20). in addition to this 1mb/s lan using the am7960, channel b of the am8530h is configured to operate a low speed rs-423/rs-232c asynchronous link. the am26ls29 driver and the am26ls32 receiver were added, as shown in figure 7C18, to provide proper signal conditioning for the cable. 7.6.4 software considerations two programs have been written for the hardware described and are listed at the end of this application note. the program for the transmitter is listed under software to transmit data at 1mb/s using dma. the program for the receiver is listed under software to re- ceive data at 1mb/s using dma. these programs enable a file to be read off a disk on one ibm* pc (xt or at), transmit it over a shielded coaxial cable to another similar pc**, and save it onto a disk on the receiving pc. the collision avoidance scheme is imple- mented in hardware. the software implementation demonstrates that the am8530h and am7960 can be simply configured for a 1mb/s data communications network. an actual operating network may need a slightly greater degree of software sophistication. the file from disk (hard or floppy) is first copied into memory. the length of the file and starting address is then determined. the am8530h serial communications controller must now be initialized for an sdlc mode of operation with dma request on transmit or receive. the initialization scheme for the am8530h involves setting up the various modes of op- eration followed by enabling the transmitter, the receiver, and dma request. the crc scheme of the am8530h is used to ensure data integrity at the receive end. finally, the interrupts are enabled if the interrupt mode of data transfer is to be used. it is important to follow the data initialization sequence as shown in the software routine for correct operation of the scc. the dma controller of the pc can then be loaded with the starting address of the data and the length of file (number of bytes to be transmitted). the dma channel must be enabled upon completion of initialization. data transmission starts as soon as dma is enabled. the transmit-underrun latch must be reset by writing a c0h to wr0 of the am8530h. this command controls the transmission of crc at the end of transmission. at the receiving station, the address (first byte after flags) of the incoming data is com- pared with the device address in wr6 of the am8530h. the remaining data are received only if an address match occurs. this process does not involve any cpu interaction. the eom and crc errors are indicated in rr0 of the am8530h. the length of the message is transmitted first, and then the entire message is transmitted. between these two transmissions, flags (7e h ) are sent on the line. in this program, cpu polls the am8530h to determine end-of-message (eom). using the same hardware connections, the scc can be programmed to interrupt on special re- ceive conditions to indicate an eom to the cpu. channel b of the am8530h is initialized for asynchronous communication at 19.2 kbaud. the asynchronous transmit routine polls bit d2 of read register 0 to determine a trans- mit buffer empty condition. writing a byte of data to the transmit buffer resets this bit. address line ad0 differentiates between a command and data access to the am8530h.
scc application notes amd 7C33 similarly, on the receive side, bit d0 of read register 0 is monitored to determine a re- ceive character available condition. this bit is reset if the receive fifo is completely empty. address line ad1 selects either synchronous or asynchronous data transfers. hence, before transmission, the user can select whether the data transfer is over a 1 mb/ s-network to similar pcs, or over a slower link to a printer. summary the am8530h can be software-manipulated to perform at a higher degree of sophistica- tion without any change in hardware connections. changing or adding to the software does not affect the am7960 operation. hence, the am7960 provides an easy upgrade (high-speed, greater distance, common-mode isola- tion) for most modern modem circuits that use rs-422 drivers and receivers.
scc application notes amd 7C34 software routines software to transmit data at 1 mb/s using dma #include stdio.h #define arraysize 40 /*size of array for the 8530 sync. init*/ #define port 0x0382 /*i/o port address for the scc channel a*/ #define aport 0x0380 /*i/o port address for 8530 channel b*/ #define aportd 0x0381 /*i/o data address for 8530 channel b*/ #define arraysiz 18 /*size of array for the 8530 async. init*/ unsigned char *ptr; unsigned int segread(); struct(int scs, sss, sds, ses; ) rv; unsigned long int data_segment; unsigned long int data_seg; unsigned int num; unsigned long int adrr; /*transmit routine*/ main() { unsigned char var_nam, string1[8], n, n; unsigned int result, res; do { /*this routine chooses between synchronous and asynchronous data transfers*/ printf(do you want to print a file(y/n)? ); var_nam = scanf(%s, string1); result + strcmp(string1,n); res = strcmp(string1,n); if(result != 0 && res != 0) { /*main routine for asynchronous data transfer*/ printf(asynch transmit\n); opnfile(); /*read file from disk into system memory*/ asccinit(); /*initialize the 8530 for asynchronous trans- mit*/ trnum(); /*transmit length of file*/ cont(); atrans(); /*transmit the entire file*/ else { /*main routine for synchronous data transfer*/ printf(synchronous transmit\n ); opnfile(); sccinit(); dmainit(); cont(); dminit(); } /*this allows the user to continue transmission of next file*/ printf(do you want to transmit another file(y/n)? ); var_nam = scanf(%s, string1); result = strcmp(string1,n); res = strcmp(string1,n); } while(result != 0 && != 0); }
scc application notes amd 7C35 /*this routine loads the file from disk to buffer memory*/ opnfile() { char var_nam, name[16],*ptrr; extern char *alloc( ); unsigned int fd, endpos, begpos, count, numd; unsigned int; int num_read, i, numr; printf(enter name of file to be transferred: ); var_nam = scanf(%s, name); fd = fopen(name, rb); endpos = fseek(fd,ol,2); /*looks for end of file*/ fclose(fd); fd = open(name, bread); /*opens the file as binary file*/ if(fd<0) { fputs(file not opened, stdout); return;} ptr = alloc(endpos+1); /*allocates memory space for file beginning at ptr*/ for(i=0;i> 0x08; *ptr = 0x02; /*address of receiving device is attached*/ adrr = 01; segread(&rv); data_segment = rv.sds; data_seg = data_segment << 4; addr = data_seg + (long int) ptr; /*absolute 20Cbit address is calculated /*this is required by the dma controller*/ /*num_read contains: if C1 error if 0 eof if >0 number of characters put in buffer*/ close(fd); return; } /*this routine initializes the 8530 for transmit*/ sccinit() { unsigned char array[arraysize]; /array to initialize scc registers*/ unsigned int i+0;
scc application notes amd 7C36 unsigned char temp; /*temporary storage for transmit/receive character array[0]=0x9 array[1]=0xc0; /*hardware reset the 8530*/ array[2]=0x4 array[3]=0x20; /*x1 clock, sdlc mode, parity disable*/ array[4]=0x1; array[5]=0x40; /*choose dma request on transmit*/ array[6]=0x3; array[7]=0xfc; /*rx 8bits/char, autoenabled, hunt mode*/ array[8]=0x5; array[9]=0x63; /*tx 8bits/char, rts enabled, txcrc enabled*/ array[10]=0x6; array[11]=0x02; /*address for this device is 02*/ array[12]=0x7; array[13]=0x7e; /*sdlc flag pattern 01111110*/ array[14]=0x9; array[15]=0x02; /*no vector is returned*/ array[16]=0xa; array[17]=0x00; /*send crc and flag on underrun, do not abort*/ array[18]=0xb; array[19]=0x08; /*rec. clock=rtxc pin, transmit clk=trxc pin*/ array[20]=0xe; array[21]=0x00; array[22]=0x3; array[23]=0xfd; /*rx enable*/ array[24]=0x5; array[25]=0x6b; /*tx enable*/ array[26]=0x00; array[27]=0x80; /*reset txcrc*/ array[28]=0x1; array[29]=0xc0; /*dma request enabled*/ array[30]=0xf; array[31]=0x08; /*disable all interrupts except dcd input*/ array[32]=0x0; array[33]=0x10; /*reset external/status interrupt twice*/ array[34]=0x0; array[35]=0x10; array[36]=0x1; array[37]=0xc9; /*rx interrupt on 1st char. or special condition*/ array[38]=0x9; array[39]=0x0a /*set master interrupt enable to 1*/ /*begin initialization routine*/ temp = inportb(port); /*read from rr0*/ while(i scc application notes amd 7C37 unsigned int lsb, temp, msb, latch, wrdh, wrdl, tmp1, start; unsigned int bytn, byt, tmp2; outportb(0x09, 0x01); /*clear all dma requests on channel 1*/ outportb(0x0a, 0x05); /*mask channel 1 dma request*/ outportb(0x0b, 0x49); /*mode register for single transfer mode, read, auto init, address increment*/ lsb = adrr & 0xff; temp = adrr >> 0x08; /*rotate ptr 8 bits to get msb*/ msb = temp & 0xff; temp = temp >> 0x08; /*rotate 8 bits to get sector address*/ latch = temp & 0x0f; outportb(0x81, latch);/*load sector address into dma page reg- ister*/ outportb(0x02, lsb); /*lower byte of starting address*/ outportb90x0b, msb); /*upper byte of starting address*/ start = adrr & 0xffff; bytn = 0x03: /*address and 2 bytes for length are transmit*/ wrdl = bytn & 0xff /*lower order byte of wordcount*/ tmp1 = bytn >> 0x08; /*rotate wordcount 8 bits for msb*/ wrdh = tmp1 & 0xff: /*upper byte of wordcount*/ outportb(0x03, wrd1); /*this is the lower byte of # of bytes that fit within the first sector*/ outportb(0x03, wrdh); /*upper byte of wordcount*/ outportb(0x0a, 0x01); /*enable dma*/ outportb(port, 0x00); outportb(port, 0xc0); /*reset transmit underrun latch*/ } /*this routine initializes the 9517 dma controller to transmit entire/ dminit() { unsigned int lsb, temp, msb, latch, wrdh, wrd1, tmp1, start; unsigned int bytn, byt, tmp2; outportb(0x09, 0x01); /*clear all dma requests on channel 1*/ outportb(0x0a, 0x05); /*mask channel 1 dma request*/ outportb(0x0b, 0x49); /*mode register for single transfer mode, read, auto init, address increment*/ lsb = adrr & 0xff; temp = adrr >> 0x08; /*rotate ptr 8 bits to get msb*/ latch = temp & 0x0f; outportb(0x81, latch);/*load sector address into dma page reg- ister*/ outportb(0x02, lsb); /*lower byte of starting address*/ outportb(0x02, msb); /*upper byte of starting address*/ start = adrr & 0xffff; bytn = num; wrd1 = bytn & 0xff; /*lower order byte of wordcount*/ tmp1 = bytn >> 0x08; /*rotate wordcount 8 bits for msb*/ wrdh = tmp1 & 0xff; /*upper byte of wordcount*/ outportb(0x03, wrd1); /*this is the lower byte of # that fit within the first sector*/ outportb(0x03, wrdh); /*upper byte of wordcount*/ outportb(0x04, 0x01); /*enable dma*/ outportb(port, 0x00); outportb(port, 0xc0); /*reset transmit underrun latch*/ } cont() /*arbitrary time delay routine*/
scc application notes amd 7C38 { unsigned long int count; count = 0; while(count<35550) { count++; } } /*this routine initializes the 8530 for asyn- chronous transmit*/ asccinit() { unsigned char array[arraysiz], temp; unsigned int i=0; array[0]=0x09; array[1]=0xc0; /*hardware reset*/ array[2]=0x4; array[3]=0x44; /*x16 clock, 1 stop bits*/ array[4]=0x3; array[5]=0xc0; /*8 bits/char.*/ array[6]=0x5; array[7]=0x60; /*8 bits/char.*/ array[8]=0xb; array[9]=0x56; /*rxc=br gen, txc=br, trxcout=br*/ array[10]=0xc; array[11]=0x06; /*set br gen for 19.2 kbaud*/ array[12]=0xd; array[13]=0x00; array[14]=0xe; array[15]=0x07; /*set dtr/req, enable br gen, pclk = br source*/ array[16]=0x5; array[17]=0x68; /*enable transmitter*/ /*begin asynchronous routine*/ temp = inportb(aport);/*read from rr0 to set up state machine*/ while(i scc application notes amd 7C39 outportb(aportd, *ptr++); /*output a character to transmit buffer*/ } } /*transmit length of file asynchronously at 19.2 kbaud*/ trnum() { unsigned char tmp, temp, tx; unsigned int i, count; for (i=0; i<0x03; i++) /*process the loop until length of file is transmitted*/ { tx = 0; while(tx==0) { temp = 0; temp = inportb(aport);/*load rr0 to check tx buffer empty bit*/ tx = temp & 0x04; } outportb(aport, *ptr++);/*output a character to transmit buffer*/ } ptr = ptr C 3; }
scc application notes amd 7C40 software to receive data at 1 mb/s using dma #include stdio.h #define arraysize 40 /*size of array for the 8530 init*/ #define port 0x0382 /*i/o port address for the scc channel a*/ #define aport 0x0380 /*i/o port address for 8530 channel b*/ #define aportd 0x0381 /*i/o data address for 8530 channel b*/ #define arraysiz 22 /*size of array for 8530 asynch. init.*/ char *ptr; unsigned int segread(); struct{int scs, sss, sds, ses; } rv; unsigned long int data_segment; unsigned long int data_seg; unsigned int num; unsigned long int adrr; /*receive routine*/ main() { unsigned int result, res; char var_nam, string1[8], n, n; do { /*choose synchronous or asynchronous receiving*/ printf(is this device a printer(y/n)? ); var_nam = scanf(%s, string1); result = strcamp(string1, n); res = strcmp(string1, n); if(result!=0 && res!=0) { /*main routine for asynchronous receive*/ num = 0x03; opnfile(); asccinit(); /*initialize 8530 for async rec.*/ printf(waiting for data\n); recnum(); /*receive length of file*/ length(); /*determine length of file*/ opnfile(); recfile(); /*receive the entire file*/ printf(wow!! i received the data!\n); closfile(); /*transfer received file to disk*/ } else { /*main routine for synchronous receive*/ num = 0x03; opnfile(); sccinit(); dmainit(); printf(waiting for data\n); end(); length(); opnfile(); dminit(); end(); printf(wow!! i received the data\n); closfile(); } /*allows user continuous reception of files*/ printf(do you wish to receive another file(y/n)? );
scc application notes amd 7C41 var_nam = scanf(%s, string1); result = strcmp(string1,n); res = strcmp(string1,n); } while(result!=0 && res!=0); } /*this routine sets a value for the starting address and allo- cates space in memory to accommodate entire length of file*/ opnfile() { extern char *alloc( ); unsigned int i; ptr = alloc(num); for(i=0; i scc application notes amd 7C42 array[23]=0xfd; /*rx enable*/ array[24]=0x5; array[25]=0x6b; /*tx enable*/ array[26]=0x00; array[27]=0x80; /*reset txcrc*/ array[28]=0x1; array[29]=0xe0; /*dma request enabled*/ array[30]=0xf; array[31]=0x00; /*disable all interrupts*/ array[32]=0x0; array[33]=0x10; /*reset external/status interrupt twice*/ array[34]=0x0; array[35]=0x10; array[36]=0x1; array[37]=0xe0; /*rx interrupt on special condition*/ array[38]=0x9; array[39]=0x02; /*set master interrupt enable to 1*/ /*begin initialization routine*/ /*the following dummy read statement is used to ensure that scc has initialized properly*/ temp = inportb(port); /*read from rr0*/ while(i> 0x08; /*rotate ptr 8 bits to get msb*/ msb = tem[ & 0xff; temp = temp >> 0x08; /*rotate 8 bits to get sector address*/ latch = temp & 0x0f; outportb(0x81, latch);/*load sector address into dma page reg- ister*/ outportb(0x02, lsb); /*lower byte of starting address*/ outportb(0x02, msb); /*upper byte of starting address*/ start = adrr & 0xffff; bytn = 0x03; wrd1 = bytn & 0xff; /*lower order byte of wordcount*/ tmp1 = bytn >> 0x08; /*rotate wordcount 8 bits for msb*/ wrdh = tmp1 & 0xff; /*upper byte of wordcount*/ outportb(0x03, wrd1); /*this is the lower byte of # of bytes that fit within the first sector outportb(0x03, wrdh); /*upper byte of wordcount*/ outportb(0x0a, 0x01); /*enable dma*/ } /*this routine writes the memory buffer on to the disk*/ closfile() { char var_nam, name[10];
scc application notes amd 7C43 unsigned int fd; int num_wr; ptr = ptr + 3; /*deletes device address and length of file before writing onto the disk*/ num = num C 3; printf(what shall i name the received file?); var_nam = scanf(%s, name); fd = creat(name, bwrite); if(fd<0) abort(\ncreat error occured\n); num_wr = write(fd, ptr, num); printf(number of bytes written to file rec.dat = %d\n,num_wr); close(fd); } /*this routine initializes the dma controller for receive*/ dminit() { unsigned int lsb, temp, msb, latch, wrdh, wrd1, tmp1, start; unsigned int bytn, byt, tmp2; outportb(0x09, 0x01); /*clear all dma requests on channel 1*/ outportb(0x0a, 0x05); /*mask channel 1 dma request*/ outportb(0x0b, 0x45); /*mode register for single transfer mode, read, auto init, address increment*/ lsb = adrr & 0xff; temp = adrr >> 0x08; /*rotate ptr 8 bits to get msb*/ msb = temp & 0xff; temp = temp >> 0x08; /*rotate 8 bits to get sector address*/ latch = temp & 0x0f; outportb(0x81, latch);/*load sector address into dma page register*/ outportb(0x02, lsb); /*lower byte of starting address*/ outportb(0x02, msb); /*upper byte of starting address*/ start = adrr & 0xffff; bytn = num; wrd1 = bytn & 0xff; /*lower order byte of wordcount*/ tmp1 = bytn >> 0x08; /*rotate wordcount 8 bits for masb*/ wrdh = tmp1 & 0xff; /*upper byte of wordcount*/ outportb(0x03, wrd1); /*this is the lower byte of # of bytes that fit within the first sector*/ outportb(0x03, wrdh); /*upper byte of wordcount*/ outportb(0x0a, 0x01); /*enable dma*/ outportb(port, 0x00); outportb(port, 0x00); /*reset transmit underrun latch*/ } /*this routine polls bit d7 in rr1 to detect an endCofCmes- sage*/ end() { unsigned char temp, ef; unsigned int count; ef = 0; temp = 0 inportb(port); outportb(port, 0x00); outportb(port, 0x30); while(ef==0) { count = 0;
scc application notes amd 7C44 inportb(port); outportb(port, 0x01); temp = inportb(port); while(count<300) { count++; } ef = temp & 0x80; } } /*this routine loads the length of the file to be received*/ length() { unsigned int *iptr; ptr++; iptr = ptr; /*assigns iptr as an address of a 16Cbit integer*/ num = *iptr; } /*this routine initializes the 8530 for async. receive*/ asccinit() { unsigned char array[arraysiz], temp; unsigned int =i=0; array[0]=0x9; array[1]=0xc0; /*hardware reset*/ array[2]=0x4; array[3]=0x44; /*x16 clock, 1 stop bits*/ array[4]=0x3; array[5]=0xe0; /*8 bits/character*/ array[6]=0x5; array[7]=0x60; /*8 bits/character*/ array[8]=0xb; array[9]=0x56; /*rxc = br gen, txc = br gen, trxcout = br*/ array[10]=0xc; array[11]=0x06; /*set br gen for 19.2 kbaud*/ array[12]=0xd; array[13]=0x00; array[14]=0xe; array[15]=0x03; /*set dtr/req, enable br gen, pclk = br source*/ array[16]=0x3; array[17]=0xe1; /*enable receiver*/ temp = inportb(aport); /*read from rr0 to set up state machine*/ while(i scc application notes amd 7C45 for(i=0; i < num; i++)/*process the loop until all char are received*/ { rx = 0; while(rx==0) { temp = inportb(aport);/*load rr0 to check for rec. char available*/ rx = temp & 0x01; } *ptr = inportb(aportd);/*input a char from the rec. fifo*/ ptr++; } ptr = ptr C num; /*restore inital value of pointer*/ } /*receive length og file asynchronously at 19.2 kbaud*/ recnum() { unsigned char temp, rx; unsigned int i, count; for(i=0; i < 0x03; i++)/*process the loop until all char are received*/ { rx = 0; while(rx==0) { temp = inportb(aport);/*load rr0 to check for rec. char available*/ rx = temp & 0x01; } *ptr = inportb(aportd);/*input a char from the rec. fifo*/ ptr++; } ptr = ptr C 0x03; ; .................................................................. ............


▲Up To Search▲   

 
Price & Availability of AM8530HAM85C30

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X